public class

Flags

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.base.Flags

Class Overview

Bit flags object, int based (allow 32 bit flags).

Summary

Public Constructors
Flags()
Create flags with the initial value 0.
Flags(int initial)
Create flags.
Flags(int initial, int allowed, Map<Integer, String> names)
Create flags and specify which bits (0..31) are legal parts of the flags.
Public Methods
boolean addTo(int f)
Add (set) bits to the current flags.
int get()
Get the current flags.
static boolean has(int flags, int bits)
Flags utility: determine if the provided bit(s) is/are set
boolean has(int f)
Determine if all of the provided bits are currently set.
boolean hasNone(int f)
Determine if none of the provided bits are currently set.
boolean hasSome(int f)
Determine if some of the provided bits are currently set.
boolean isValidBit(int bit)
boolean removeFrom(int f)
Remove (reset) bits from the current flags.
static int set(int flags, int bits, boolean enabled)
Flags utility: set or reset bits.
boolean set(int flags)
Set the flags.
boolean testBit(int bit)
String toString()
boolean update(int f, boolean add)
Add or remove bits to the current flags.
void verify(int f)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Flags ()

Create flags with the initial value 0.

public Flags (int initial)

Create flags.

Parameters
initial initial flags value

public Flags (int initial, int allowed, Map<Integer, String> names)

Create flags and specify which bits (0..31) are legal parts of the flags.

Parameters
initial initial flags value
allowed legal bit flags; 0xFFFFFFFF (-1) means all bits are legal and can be accessed
names optional bit names

Public Methods

public boolean addTo (int f)

Add (set) bits to the current flags.

Returns
  • true if the overall flags have changed, false otherwise

public int get ()

Get the current flags.

public static boolean has (int flags, int bits)

Flags utility: determine if the provided bit(s) is/are set

Parameters
flags current flags
bits bits to check
Returns
  • true if the provided bits are all set, false otherwise

public boolean has (int f)

Determine if all of the provided bits are currently set.

public boolean hasNone (int f)

Determine if none of the provided bits are currently set.

public boolean hasSome (int f)

Determine if some of the provided bits are currently set.

public boolean isValidBit (int bit)

public boolean removeFrom (int f)

Remove (reset) bits from the current flags.

Returns
  • true if the overall flags have changed, false otherwise

public static int set (int flags, int bits, boolean enabled)

Flags utility: set or reset bits.

Parameters
flags current flags
bits bit(s) to set or reset
enabled true to set, false to reset
Returns
  • updated flags

public boolean set (int flags)

Set the flags.

Returns
  • true if the flags have changed, false otherwise

public boolean testBit (int bit)

public String toString ()

public boolean update (int f, boolean add)

Add or remove bits to the current flags.

Parameters
add true to add flags, false to remove flags
Returns
  • true if the overall flags have changed, false otherwise

public void verify (int f)