org.echarts
Class MachineCode

java.lang.Object
  extended by org.echarts.MachineCode
All Implemented Interfaces:
java.io.Serializable

public final class MachineCode
extends java.lang.Object
implements java.io.Serializable

Encoding of this machine's relative location in the tree of machines. The encoding is meant to optimize ancestor-descendant queries. The encoding is based on an approach by N. Meghanathan and S. Baskiyar described in "Binary Codes for Fast Determination of Ancestor- Descendant Relationship in Trees", Dept of Computer Science and Software Engineering, Auburn Univ, Auburn, AL. Code is of the form "0...0bbb...bbb" where prefix of 0's are padding bits, and the suffix of 'b' bits represents a unique code for a machine node. The total number of bits in the suffix and prefix equals the length of the 'long' word minus one bit (see below for explanation) but the length of the prefix and suffix varies. The code value for the root node is 0. A child node is assigned a unique index that is appended to the parent's code, forming the child's code.

See Also:
Serialized Form

Field Summary
static MachineCode ROOT_CODE
           
static long serialVersionUID
           
 
Constructor Summary
MachineCode()
          Constructor for root code.
MachineCode(MachineCode parentCode, int indexBound, int index)
          Constructor for child code.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 boolean isSubmachineOf(MachineCode otherCode)
          Returns true if machine represented by this machine code is a submachine of the machine represented by the specified machine code.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

ROOT_CODE

public static MachineCode ROOT_CODE
Constructor Detail

MachineCode

public MachineCode()
Constructor for root code.


MachineCode

public MachineCode(MachineCode parentCode,
                   int indexBound,
                   int index)
            throws MachineException
Constructor for child code. Specifies index bound to use for coding specified index. For example, if bound is 8 then min index value is 0 and max index value is 7.

Throws:
MachineException
Method Detail

isSubmachineOf

public final boolean isSubmachineOf(MachineCode otherCode)
Returns true if machine represented by this machine code is a submachine of the machine represented by the specified machine code.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object