Package ej.basictool

Class BitFieldHelper


  • public class BitFieldHelper
    extends Object
    Helper to manage bit fields.
    • Method Detail

      • setBooleanProperty

        public static int setBooleanProperty​(int field,
                                             boolean value,
                                             int mask)
        Sets a boolean value in a bit field.
        Parameters:
        field - the bit field.
        value - the value to set.
        mask - the bit mask of the value in the int.
        Returns:
        the modified bit field.
      • setBooleanPropertyAtOffset

        public static int setBooleanPropertyAtOffset​(int field,
                                                     boolean value,
                                                     int offset)
        Sets a boolean value in a bit field.
        Parameters:
        field - the bit field.
        value - the value to set.
        offset - the offset of the boolean in the int.
        Returns:
        the modified bit field.
      • setBooleanProperty

        public static int setBooleanProperty​(int field,
                                             int mask)
        Forces the boolean to true in a bit field.
        Parameters:
        field - the bit field.
        mask - the bit mask of the value in the int.
        Returns:
        the modified bit field.
      • setBooleanPropertyAtOffset

        public static int setBooleanPropertyAtOffset​(int field,
                                                     int offset)
        Forces the boolean to true in a bit field.
        Parameters:
        field - the bit field.
        offset - the offset of the boolean in the int.
        Returns:
        the modified bit field.
      • unsetBooleanProperty

        public static int unsetBooleanProperty​(int field,
                                               int mask)
        Forces the boolean to false in a bit field.
        Parameters:
        field - the bit field.
        mask - the bit mask of the value in the int.
        Returns:
        the modified bit field.
      • unsetBooleanPropertyAtOffset

        public static int unsetBooleanPropertyAtOffset​(int field,
                                                       int offset)
        Forces the boolean to false in a bit field.
        Parameters:
        field - the bit field.
        offset - the offset of the boolean in the int.
        Returns:
        the modified bit field.
      • getBooleanProperty

        public static boolean getBooleanProperty​(int field,
                                                 int mask)
        Gets a boolean value in a bit field.
        Parameters:
        field - the bit field.
        mask - the bit mask of the value in the int.
        Returns:
        the boolean value.
      • getBooleanPropertyAtOffset

        public static boolean getBooleanPropertyAtOffset​(int field,
                                                         int offset)
        Gets a boolean value in a bit field.
        Parameters:
        field - the bit field.
        offset - the offset of the boolean in the int.
        Returns:
        the boolean value.
      • setIntProperty

        public static int setIntProperty​(int field,
                                         int value,
                                         int mask,
                                         int offset)
        Sets a int value in a bit field.
        Parameters:
        field - the bit field.
        value - the value to set.
        mask - the bit mask of the value in the int.
        offset - the offset of the value in the int.
        Returns:
        the modified bit field.
      • getIntProperty

        public static int getIntProperty​(int field,
                                         int mask,
                                         int offset)
        Gets a int value in a bit field.
        Parameters:
        field - the bit field.
        mask - the bit mask of the value in the int.
        offset - the offset of the value in the int.
        Returns:
        the int value.