com.singularsys.aa
Class Solution

java.lang.Object
  extended by com.singularsys.aa.Solution

public class Solution
extends java.lang.Object

Encapsulates a set of name-value pairs in a Hashtable as a solution satisfying an equation system.


Constructor Summary
Solution()
          Creates a new Solution
 
Method Summary
 void addSolution(java.lang.String name, java.lang.Object value)
          Adds a name-value pair to the set.
 void append(Solution sol)
          Appends the variable-value pairs of the solution
 boolean equals(java.lang.Object o, double tolFactor)
          Returns true if all values are equal within the specified tolerance, false otherwise.
 java.lang.Object getValue(java.lang.String name)
           
 java.util.Enumeration getValues()
           
 java.util.Enumeration getVariableNames()
           
 java.lang.String toString()
          Returns a string listing the name-value pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Solution

public Solution()
Creates a new Solution

Method Detail

addSolution

public void addSolution(java.lang.String name,
                        java.lang.Object value)
Adds a name-value pair to the set.


getVariableNames

public java.util.Enumeration getVariableNames()
Returns:
An enumeration of the variable names.

getValues

public java.util.Enumeration getValues()
Returns:
An enumeration of the variable values.

getValue

public java.lang.Object getValue(java.lang.String name)
Parameters:
name - The name of the variable.
Returns:
The value of the variable
name
,
null
if the variable does not exist.

toString

public java.lang.String toString()
Returns a string listing the name-value pairs.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object o,
                      double tolFactor)
Returns true if all values are equal within the specified tolerance, false otherwise.

Parameters:
o - The object to be compared to.
tolFactor - The tolerance factor, which is used according to

v_other*(1-tolFactor) < v_this < v_other*(1+tolFactor)

where v_other is the value of a variable from

o
, and v_this is the value of the same variable from this object.
Returns:
Returns true if all values are equal within the specified tolerance, false otherwise.

append

public void append(Solution sol)
            throws java.lang.IllegalArgumentException
Appends the variable-value pairs of the solution
sol
to this solution.

Parameters:
sol - the solution to be appended.
Throws:
java.lang.IllegalArgumentException - if a variable name to be appended already exists in this solution.