jasi.sim.basic.table
Class ConditionTree

java.lang.Object
  extended by jasi.sim.basic.table.ConditionTree
All Implemented Interfaces:
java.io.Serializable

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

A condition table, that allows to retrieve values from a set of conditions based on an if-then-else structure. The conditions are represented by key-value-pairs. The condition table provides the ability to enter values for a default key. This value will be retrieved, if another key will not fit.

See Also:
Serialized Form

Nested Class Summary
static class ConditionTree.Line
          Line in a condition table.
 
Constructor Summary
ConditionTree()
          Table constructor.
ConditionTree(java.lang.String name)
          Table constructor.
 
Method Summary
 void addLine(java.lang.Object values)
          Add a condition line to this table.
 void addLine(java.lang.Object[] values)
          Add a condition line to this table.
 void addLine(java.lang.Object[] keys, java.lang.Object values)
          Add a condition line to this table.
 void addLine(java.lang.Object[] keys, java.lang.Object[] values)
          Add a condition line to this table.
 void addLine(java.lang.Object keys, java.lang.Object values)
          Add a condition line to this table.
 void addLine(java.lang.Object keys, java.lang.Object[] values)
          Add a condition line to this table.
 boolean equals(java.lang.Object o)
          Indicates, whether some other object is "equal to" this one.
 java.lang.Object[] find(java.lang.Object[] keys)
          Find the value for a key.
 java.util.List<ConditionTree.Line> getLines()
          Get the lines of this table.
 java.lang.String getName()
          Get this table's ID.
 int hashCode()
          Returns the hash code value for this assignable object.
 void setLines(java.util.List<ConditionTree.Line> lines)
          Set the lines of this table.
 void setName(java.lang.String name)
          Set this table's ID.
 java.lang.String toString()
          Returns a string representation of this table.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConditionTree

public ConditionTree()
Table constructor.


ConditionTree

public ConditionTree(java.lang.String name)
Table constructor.

Parameters:
name - The name of table as identifier.
Method Detail

getName

public java.lang.String getName()
Get this table's ID.

Returns:
The ID.

setName

public void setName(java.lang.String name)
Set this table's ID.

Parameters:
name - The ID.

setLines

public void setLines(java.util.List<ConditionTree.Line> lines)
Set the lines of this table.

Parameters:
lines - The lines.

getLines

public java.util.List<ConditionTree.Line> getLines()
Get the lines of this table.

Returns:
The lines.

toString

public java.lang.String toString()
Returns a string representation of this table.

Overrides:
toString in class java.lang.Object
Returns:
The string.

hashCode

public int hashCode()
Returns the hash code value for this assignable object. The hash code of a assignable object is defined to be the hashCode of the enclose value of the object, which implements the ConditionType interface. This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode() for any two objects t1 and t2, as required by the general contract of Object.hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code value for this object.

equals

public boolean equals(java.lang.Object o)
Indicates, whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - That object which is compared with this object.
Returns:
True, if this object is the same as that object.

addLine

public void addLine(java.lang.Object values)
Add a condition line to this table.

Parameters:
values - The values.

addLine

public void addLine(java.lang.Object[] values)
Add a condition line to this table.

Parameters:
values - The values.

addLine

public void addLine(java.lang.Object keys,
                    java.lang.Object values)
Add a condition line to this table.

Parameters:
keys - The keys.
values - The values.

addLine

public void addLine(java.lang.Object[] keys,
                    java.lang.Object values)
Add a condition line to this table.

Parameters:
keys - The keys.
values - The values.

addLine

public void addLine(java.lang.Object keys,
                    java.lang.Object[] values)
Add a condition line to this table.

Parameters:
keys - The keys.
values - The values.

addLine

public void addLine(java.lang.Object[] keys,
                    java.lang.Object[] values)
Add a condition line to this table.

Parameters:
keys - The keys.
values - The values.

find

public java.lang.Object[] find(java.lang.Object[] keys)
Find the value for a key.

Parameters:
keys - The key.
Returns:
The value or null, if not found.