Class MachineCode

  extended by org.echarts.MachineCode
All Implemented Interfaces:

public final class MachineCode
extends java.lang.Object

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
          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


public static final long serialVersionUID
See Also:
Constant Field Values


public static MachineCode ROOT_CODE
Constructor Detail


public MachineCode()
Constructor for root code.


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.

Method Detail


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.


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


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