Lexical Tools

Bit Mask Base

Bit Mask

The BitMaskBase class is the base class of Category, Inflection, Gender, and Flow classes. This class includes following data members:

  • value: the value in long of this object
  • name: the name in String of this object
  • bit: the index of the bit array
  • bit flag: the flag value in boolean of the bit array

The bit mask base class is used as the parent class for Category, inflection, flow components, and gender. Java type long (64 bits) is used for the value so that it is capable of holding up to 63 bits. Thus, the limitation on the total number of flow component is 63. The value can be used to represent one single name as well as a combination of multiple names. For examples, "saw" is a noun (128) and a verb (1024). It can be represented as a value of 1152 (= 128 + 1124).

This class and its child classes provide methods to transfer between above four data members and are described as follows:

Static (class) methods:

InputsMethodsreturns
Name (String)long ToValue(String name)Value (long)
Bit Name (String)long Enumerate(String bitName)Value (long)
Bit (int)long GetBitValue(int bit)Value (long)
Value (long)String ToName(long value)Name (String)
Bit Index (int)String GetBitName(int bit)Name (String)
Bit Index (int)String GetBitName(int bit, int index)Name (String)
Value (long)int GetBitIndex(long value)Bit Index (int)
Value (long)boolean Contains(long owner, long ownee)true or false

instance (object) methods:

InputsMethodsreturns
.long GetValue()value (long)
.String GetName()name (String)
bit index (int)boolean GetBitFlag(int bitIndex)true/false
value (long)boolean Contains(long value)true/false
Value (long)void SetValue(long value)void
index (int)void SetBitFlag(bitIndex int, bitFlag boolean)void

The BitMaskBase class has four child classes and is detailed as follows: