linearalgebra.symbolic
Class AbstractUnknown

java.lang.Object
  extended by linearalgebra.symbolic.AbstractUnknown
All Implemented Interfaces:
SymbolicValue
Direct Known Subclasses:
LeafUnknown, PairOperator, UnaryOperator

public abstract class AbstractUnknown
extends java.lang.Object
implements SymbolicValue


Field Summary
private  boolean containsAnswerCache
           
private  SymbolicValue containsNodeCache
           
private  java.util.ArrayList<SymbolicValue> m_parents
           
 
Fields inherited from interface linearalgebra.symbolic.SymbolicValue
ADDS, LEAF, MULT
 
Constructor Summary
AbstractUnknown()
           
 
Method Summary
 void addParent(SymbolicValue parent)
          Adds a parent to the nodes parent list.
protected  void appendParenthesisString(SymbolicValue v, java.lang.StringBuffer str)
           
 boolean contains(SymbolicValue v, SymbolicValue parent)
          Searches the tree for the SymbolicValue v.
 SymbolicValue getParent(int index)
          Returns the parent specified by the index.
 int getParentCount()
          Returns the number of nodes that have this subtree as a child.
 boolean isNormal()
          Checks if each child in the tree should be operated on first according to the operator precedence.
 void removeParent(SymbolicValue parent)
           
 SymbolicValue scale(SymbolicValue v)
           
 void subTreeChanged()
          Invalidates cached information about the tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface linearalgebra.symbolic.SymbolicValue
getChild, getChildCount, getNumericValue, getPrecedence
 

Field Detail

m_parents

private java.util.ArrayList<SymbolicValue> m_parents

containsNodeCache

private SymbolicValue containsNodeCache

containsAnswerCache

private boolean containsAnswerCache
Constructor Detail

AbstractUnknown

public AbstractUnknown()
Method Detail

scale

public final SymbolicValue scale(SymbolicValue v)
Specified by:
scale in interface SymbolicValue

isNormal

public boolean isNormal()
Description copied from interface: SymbolicValue
Checks if each child in the tree should be operated on first according to the operator precedence.

Specified by:
isNormal in interface SymbolicValue

getParentCount

public final int getParentCount()
Description copied from interface: SymbolicValue
Returns the number of nodes that have this subtree as a child.

Specified by:
getParentCount in interface SymbolicValue

addParent

public final void addParent(SymbolicValue parent)
Description copied from interface: SymbolicValue
Adds a parent to the nodes parent list.

Specified by:
addParent in interface SymbolicValue

removeParent

public final void removeParent(SymbolicValue parent)
Specified by:
removeParent in interface SymbolicValue

getParent

public final SymbolicValue getParent(int index)
Description copied from interface: SymbolicValue
Returns the parent specified by the index. Throws an ArrayOutOfBoundsException if the index is invalid.

Specified by:
getParent in interface SymbolicValue

contains

public boolean contains(SymbolicValue v,
                        SymbolicValue parent)
Description copied from interface: SymbolicValue
Searches the tree for the SymbolicValue v. Returns true if it contains the element, and false otherwise. The parent is passed in to allow easier tree traversal.

Specified by:
contains in interface SymbolicValue

subTreeChanged

public void subTreeChanged()
Description copied from interface: SymbolicValue
Invalidates cached information about the tree.

Specified by:
subTreeChanged in interface SymbolicValue

appendParenthesisString

protected final void appendParenthesisString(SymbolicValue v,
                                             java.lang.StringBuffer str)