jopt.csp.spi.arcalgorithm.variable
Class GenericNumExprBase

java.lang.Object
  extended byjopt.csp.spi.arcalgorithm.variable.VariableChangeBase
      extended byjopt.csp.spi.arcalgorithm.variable.NumExprBase
          extended byjopt.csp.spi.arcalgorithm.variable.GenericNumExprBase
All Implemented Interfaces:
jopt.csp.variable.CspNumExpr, GenericNumExpr, NumExpr, TrigExpr, VariableChangeSource
Direct Known Subclasses:
GenericDoubleExpr, GenericFloatExpr, GenericIntExpr, GenericLongExpr

public abstract class GenericNumExprBase
extends NumExprBase
implements GenericNumExpr

A generic variable such as Xi which represents X1, X2, etc.


Method Summary
 void addVariableChangeListener(VariableChangeListener listener)
          Adds a listener interested in variable change events
 boolean containsIndex(GenericIndex index)
          Returns true if this expression contains the given index
 NumExpr createFragment(GenericIndex[] fragIndices)
          Returns a fragment of this expression given an array of indices that represent the portion of the fragment.
 Arc[] getBooleanSourceArcs()
          Returns array of arcs that will affect the boolean true / false value of this constraint upon a change
 int getExpressionCount()
          Returns the number of expressions that are wrapped by this generic node
 NumNode[] getExpressionNodes()
          Returns the nodes for all expressions in the internal array
 GenericIndex[] getGenericIndices()
          Returns the generic indices that is associated with this expression
 jopt.csp.variable.CspGenericIndex[] getIndices()
          Returns the generic indices that is associated with this expression
 java.lang.Number getNextHigher(java.lang.Number val)
          Returns the next higher value in this variable's domain or current value if none exists
 java.lang.Number getNextLower(java.lang.Number val)
          Returns the next lower value in this variable's domain or current value if none exists
 NumExpr getNumExpression(int offset)
          returns a numeric expression from the internal array
 NumExpr getNumExpressionForIndex()
          Returns the internal variable corresponding to the associated index's current value
 java.lang.Number getNumLargestMax()
          Returns that largest maximal value of all variables in array
 java.lang.Number getNumLargestMax(int start, int end)
          Returns that largest maximal value of all variables in array within start and end indices
 java.lang.Number getNumLargestMin()
          Returns that largest minimal value of all variables in array
 java.lang.Number getNumLargestMin(int start, int end)
          Returns that largest minimal value of all variables in array within start and end indices
 java.lang.Number getNumMax()
          Returns maximum value of node
 java.lang.Number getNumMin()
          Returns minimal value of node
 java.lang.Number getNumSmallestMax()
          Returns that smallest maximal value of all variables in array
 java.lang.Number getNumSmallestMax(int start, int end)
          Returns that smallest maximal value of all variables in array within start and end indices
 java.lang.Number getNumSmallestMin()
          Returns that smallest minimal value of all variables in array
 java.lang.Number getNumSmallestMin(int start, int end)
          Returns that smallest minimal value of all variables in array within start and end indices
 double getPrecision()
          Returns precision associated with this domain
 boolean isBound()
          Returns true if all internal expressions are bound
 boolean isInDomain(java.lang.Number n)
          Returns true if value is in domain of this expression
 void removeVariableChangeListener(VariableChangeListener listener)
          Removes a variable listener from this variable
 void setIndicesToVariableOffset(int offset)
          Updates associated indices to values corresponding to the node offset in the internal array
 void setPrecision(double p)
          Sets precision associated with this domain
 java.lang.String toString()
          Displays name of variable along with indices
 void updateGraph(NodeArcGraph graph)
          Adds arcs representing this expression to the node arc graph
 
Methods inherited from class jopt.csp.spi.arcalgorithm.variable.NumExprBase
between, between, between, between, eq, equals, geq, getDomain, getName, getNodeCollection, gt, hashCode, leq, lt, neq, notBetween, notBetween, notBetween, notBetween, setName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jopt.csp.spi.arcalgorithm.constraint.num.NumExpr
getName, getNode, getNodeCollection, getNumberType
 

Method Detail

getBooleanSourceArcs

public Arc[] getBooleanSourceArcs()
Returns array of arcs that will affect the boolean true / false value of this constraint upon a change

Specified by:
getBooleanSourceArcs in interface NumExpr
Overrides:
getBooleanSourceArcs in class NumExprBase

getExpressionNodes

public NumNode[] getExpressionNodes()
Returns the nodes for all expressions in the internal array


setPrecision

public void setPrecision(double p)
Sets precision associated with this domain

Specified by:
setPrecision in interface NumExpr

getPrecision

public double getPrecision()
Returns precision associated with this domain

Specified by:
getPrecision in interface NumExpr

getIndices

public jopt.csp.variable.CspGenericIndex[] getIndices()
Returns the generic indices that is associated with this expression


getGenericIndices

public GenericIndex[] getGenericIndices()
Returns the generic indices that is associated with this expression

Specified by:
getGenericIndices in interface GenericNumExpr

containsIndex

public boolean containsIndex(GenericIndex index)
Returns true if this expression contains the given index

Specified by:
containsIndex in interface GenericNumExpr

isBound

public boolean isBound()
Returns true if all internal expressions are bound

Specified by:
isBound in interface NumExpr
Overrides:
isBound in class NumExprBase

getNumExpressionForIndex

public NumExpr getNumExpressionForIndex()
Returns the internal variable corresponding to the associated index's current value

Specified by:
getNumExpressionForIndex in interface GenericNumExpr

getExpressionCount

public int getExpressionCount()
Returns the number of expressions that are wrapped by this generic node

Specified by:
getExpressionCount in interface GenericNumExpr

getNumExpression

public NumExpr getNumExpression(int offset)
returns a numeric expression from the internal array

Specified by:
getNumExpression in interface GenericNumExpr
Parameters:
offset - Offset of expression in internal expression array

toString

public java.lang.String toString()
Displays name of variable along with indices

Overrides:
toString in class NumExprBase

addVariableChangeListener

public void addVariableChangeListener(VariableChangeListener listener)
Adds a listener interested in variable change events

Specified by:
addVariableChangeListener in interface VariableChangeSource
Overrides:
addVariableChangeListener in class NumExprBase

removeVariableChangeListener

public void removeVariableChangeListener(VariableChangeListener listener)
Removes a variable listener from this variable

Specified by:
removeVariableChangeListener in interface VariableChangeSource
Overrides:
removeVariableChangeListener in class NumExprBase

updateGraph

public void updateGraph(NodeArcGraph graph)
Adds arcs representing this expression to the node arc graph

Specified by:
updateGraph in interface NumExpr
Overrides:
updateGraph in class NumExprBase

getNumLargestMax

public java.lang.Number getNumLargestMax()
Returns that largest maximal value of all variables in array

Specified by:
getNumLargestMax in interface GenericNumExpr

getNumMin

public final java.lang.Number getNumMin()
Returns minimal value of node

Specified by:
getNumMin in interface NumExpr

getNumMax

public final java.lang.Number getNumMax()
Returns maximum value of node

Specified by:
getNumMax in interface NumExpr

getNumLargestMax

public java.lang.Number getNumLargestMax(int start,
                                         int end)
Returns that largest maximal value of all variables in array within start and end indices

Specified by:
getNumLargestMax in interface GenericNumExpr

getNumSmallestMax

public java.lang.Number getNumSmallestMax()
Returns that smallest maximal value of all variables in array

Specified by:
getNumSmallestMax in interface GenericNumExpr

getNumSmallestMax

public java.lang.Number getNumSmallestMax(int start,
                                          int end)
Returns that smallest maximal value of all variables in array within start and end indices

Specified by:
getNumSmallestMax in interface GenericNumExpr

getNumLargestMin

public java.lang.Number getNumLargestMin()
Returns that largest minimal value of all variables in array

Specified by:
getNumLargestMin in interface GenericNumExpr

getNumLargestMin

public java.lang.Number getNumLargestMin(int start,
                                         int end)
Returns that largest minimal value of all variables in array within start and end indices

Specified by:
getNumLargestMin in interface GenericNumExpr

getNumSmallestMin

public java.lang.Number getNumSmallestMin()
Returns that smallest minimal value of all variables in array

Specified by:
getNumSmallestMin in interface GenericNumExpr

getNumSmallestMin

public java.lang.Number getNumSmallestMin(int start,
                                          int end)
Returns that smallest minimal value of all variables in array within start and end indices

Specified by:
getNumSmallestMin in interface GenericNumExpr

setIndicesToVariableOffset

public final void setIndicesToVariableOffset(int offset)
Updates associated indices to values corresponding to the node offset in the internal array


getNextHigher

public java.lang.Number getNextHigher(java.lang.Number val)
Description copied from interface: NumExpr
Returns the next higher value in this variable's domain or current value if none exists

Specified by:
getNextHigher in interface NumExpr

getNextLower

public java.lang.Number getNextLower(java.lang.Number val)
Description copied from interface: NumExpr
Returns the next lower value in this variable's domain or current value if none exists

Specified by:
getNextLower in interface NumExpr

isInDomain

public boolean isInDomain(java.lang.Number n)
Description copied from interface: TrigExpr
Returns true if value is in domain of this expression

Specified by:
isInDomain in interface TrigExpr

createFragment

public final NumExpr createFragment(GenericIndex[] fragIndices)
Description copied from interface: GenericNumExpr
Returns a fragment of this expression given an array of indices that represent the portion of the fragment. If the indices for the fragment cover all indices this expression is based upon, the specific expression specified will be returned. If the indices do not cover all indices, a generic variable will be returned based upon the remaining indices in this expression composed of all the variables selected by the fragment indices.

Specified by:
createFragment in interface GenericNumExpr
Parameters:
fragIndices - Indices that represent the fragment to return. Each index must have a current value for this function to work correctly
Returns:
Numeric expression that is a fragment of this expression