Class BitwiseFlagSystem<T>

java.lang.Object
soot.jimple.infoflow.android.axml.flags.BitwiseFlagSystem<T>
Type Parameters:
T - the keys used to distinguish flags

public class BitwiseFlagSystem<T> extends Object
In some cases, bitmasks might be used in a way where there is a precendence of certain masks to save space. For "normal" bitmasks, the traditional way of checking is much faster. Simple Example: Option A (can be used alone or in combination with others): 01 Option B (cannot be used with option A): 10 Option C (only valid when used with Option A): 11 In this case, we could do checking of B via ((v & 10) == 1) && ((v & 1) != 1) but sometimes there are a lot of options (e.g. inputType)
  • Constructor Details

    • BitwiseFlagSystem

      public BitwiseFlagSystem()
  • Method Details

    • register

      public void register(T key, int setBits)
      Associate the given key with the bits set in set bits. The first registration wins.
      Parameters:
      key - the key
      setBits - the bits set
    • getFlags

      public final Collection<T> getFlags(int value)
      Returns all matching flags
      Parameters:
      value - input value
    • isSet

      @SafeVarargs public final boolean isSet(int inputValue, T... flag)
      Checks whether all the given flags are set
      Parameters:
      inputValue - input value
      flag - the flags to check