ru.novosoft.dc.core.util
Class Toggles

java.lang.Object
  |
  +--ru.novosoft.dc.core.util.Toggles

public class Toggles
extends java.lang.Object
implements java.lang.Cloneable

The class contains an array of multistate toggles of the byte type. The array length is specifed while constructing. Two primitive operations, namely set and get, are provided. The class allows the deep copy and deep compare operations.


Constructor Summary
Toggles(byte[] toggles)
          Construct an object as a wrapper of the specified array of toggles.
Toggles(int size)
          Construct an array of toggles of the specified size.
 
Method Summary
 java.lang.Object clone()
          Create a deep copy of this object.
 boolean equals(java.lang.Object obj)
          Compare this object with another vector of toggles and return true if they coinside.
 int get(int index)
          Return the toggle of the specified index.
 int set(int index, int value)
          Set a toggle of the specified index and return the original value (non-truncated to the byte type).
 int size()
          Return a length of the array.
 byte[] toggles()
          Return the array of toggles wrapped by this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Toggles

public Toggles(int size)
Construct an array of toggles of the specified size.

Toggles

public Toggles(byte[] toggles)
Construct an object as a wrapper of the specified array of toggles.
Method Detail

size

public final int size()
Return a length of the array.

toggles

public final byte[] toggles()
Return the array of toggles wrapped by this object.

get

public final int get(int index)
Return the toggle of the specified index.

set

public final int set(int index,
                     int value)
Set a toggle of the specified index and return the original value (non-truncated to the byte type).

clone

public java.lang.Object clone()
Create a deep copy of this object.
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compare this object with another vector of toggles and return true if they coinside.
Overrides:
equals in class java.lang.Object