at.dms.util
Class ArrayOf2BitValues

java.lang.Object
  |
  +--at.dms.util.ArrayOf2BitValues

public class ArrayOf2BitValues
extends java.lang.Object

An array of 2-bit values.


Constructor Summary
ArrayOf2BitValues()
          Constructs instance with default size.
ArrayOf2BitValues(int[] array)
          Constructs instance from an array of integers, where each integer in that array contains 16 2-bit values, the logically first value in the least significant bits of each integer, and the logically last 2-bit value in that integer in the most significant bits.
 
Method Summary
 int get(int index)
          Returns the 2-bit value at the specified logical index in the array.
 int[] getInternalArray()
          Returns the internal bit array with a layout that is described in the constructor that takes an int[] as its single argument.
 void set(int index, int value)
          Overwrites the 2-bit value at the specified logical index in the array.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayOf2BitValues

public ArrayOf2BitValues(int[] array)
Constructs instance from an array of integers, where each integer in that array contains 16 2-bit values, the logically first value in the least significant bits of each integer, and the logically last 2-bit value in that integer in the most significant bits.

ArrayOf2BitValues

public ArrayOf2BitValues()
Constructs instance with default size. The size automatically increases as bigger indices are used.
Method Detail

set

public final void set(int index,
                      int value)
Overwrites the 2-bit value at the specified logical index in the array.
Parameters:
index - Is a logical index in the array. If the index is greater or equals to the current size of the array, the array has its size increased.
value - A 2-bit value.

get

public final int get(int index)
Returns the 2-bit value at the specified logical index in the array.
Parameters:
index - Is a logical index in the array. If the index is greater or equal to the current size of the array, the return value is 0.
Returns:
The 2-bit value at logical index index, or 0 if index is too large.

getInternalArray

public final int[] getInternalArray()
Returns the internal bit array with a layout that is described in the constructor that takes an int[] as its single argument.
See Also:
ArrayOf2BitValues(int[])