public class SimpleRel extends RelNode
net.mumie.mathletfactory.algebra.op.Operation
s for the left hand and
right hand side and a relation sign
, which is
represented by a string and denotes the type of this relation
("=", ">", ">=", "!=", etc.).Modifier and Type | Field and Description |
---|---|
protected Operation |
m_leftHandSide
The left hand side operation of this simple relation.
|
protected int |
m_normalForm
This variable determines, whether this simple relation should be kept in
normalized state and at which level. the possible values are
net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_NONE ,
net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_REL ,
net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_OP
and net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_OP_SEPARATED . |
protected java.lang.String |
m_relationSign
The relation sign for this simple relation.
|
protected Operation |
m_rightHandSide
The right hand side operation of this simple relation.
|
m_children, m_parent, m_relation
m_numberClass
Constructor and Description |
---|
SimpleRel(java.lang.Class numberClass,
java.lang.String expression,
int normalForm)
Parses a simple relation from the given expression (should be something
like "f(x,y,...) >= g(a,b,...)") and constructs it using
normalForm as flag, whether the left and right hand side
should be normalized. |
SimpleRel(Operation leftHandSide,
Operation rightHandSide,
java.lang.String relationSign,
int normalform)
Constructs a simple relation from a given left and right hand side, a
relation sign and a flag indicating, whether the left and right hand
side should be normalized.
|
SimpleRel(Operation leftHandSide,
java.lang.String relationSign)
The Constructor for relations of type "expression > 0" , "expression = 0",
etc.
|
SimpleRel(Operation leftHandSide,
java.lang.String rightHandSide,
java.lang.String relationSign)
The Constructor for relations of type "expression > 0" , "expression = 0",
etc.
|
SimpleRel(SimpleRel relation)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns the deep copied tree rooted by this node.
|
boolean |
equals(java.lang.Object shouldBeASimpleRel)
Two simple relations are considered equal if they both include each other.
|
boolean |
evaluate(java.util.HashMap variableValues)
Returns true if the given set of values satisfies the relation, false if
not.
|
boolean |
evaluate(MNumber[] assignedValues)
Returns true if the given set of values assigned to the used variables
(alphabetically sorted) satisfies the relation.
|
boolean |
evaluateFast()
Returns true if the relation represented by this node evaluates to true
for the variable values already assigned.
|
int |
getDepth(boolean opNodesCount)
Returns the depth of the subtree rooted by this node.
|
Interval[] |
getIntervalsFalse(double epsilon,
Interval interval)
Returns the set representation of the right hand side of negated version
of this simple relation.
|
Interval[] |
getIntervalsTrue(double epsilon,
Interval interval)
Returns the set representation of the right hand side of this simple relation.
|
Operation |
getLeftHandSide()
Returns the left hand side of this (in)equation.
|
int |
getNormalForm()
Returns whether the operations (left and right hand side) of this
simple relation are in normal form.
|
java.lang.String |
getRelationSign()
Returns the relation Sign for this simple relation.
|
Operation |
getRightHandSide()
Returns the right hand side of this (in)equation.
|
java.util.HashSet |
getUsedVariables(java.util.HashSet usedVariables)
Returns all used variables as a HashSet of identifiers (Strings).
|
java.util.HashMap |
getVariableOps()
Returns a HashMap that contains the identifiers of all the used
variables as keys and a list with the corresponding
net.mumie.mathletfactory.algebra.op.node.VariableOp s as values. |
boolean |
includes(SimpleRel aRel)
Retursn true, if this simple relation logically includes the given simple relation, i.e.
|
boolean |
isLeaf()
Returns true if the node has no children.
|
RelNode |
negate(boolean deepCopy)
* logically negates this simple relation by replacing the relation
sign with its counterpart (e.g. "=" is replaced with "!
|
SimpleRel |
negated()
Returns a new simple relation that is the logical negated equivalent of
this simple relation.
|
void |
normalizeOp() |
void |
parse(java.lang.String relationString)
Sets this simple relation as the symbolic representation of the given
string.
|
void |
separateFor(java.lang.String string)
Phantom implementation, should not be called.
|
void |
setLeftHandSide(Operation leftHandSide)
Sets the left hand side of this (in)equation.
|
void |
setLeftHandSide(OpNode leftHandSide)
Sets the left hand side of this (in)equation.
|
void |
setNormalForm(int normalForm)
Sets the operations (left and right hand side) of this simple relation
to normal form.
|
void |
setRelationSign(java.lang.String sign)
Sets the relation Sign for this simple relation.
|
void |
setRightHandSide(Operation rightHandSide)
Sets the right hand side of this (in)equation.
|
void |
setRightHandSide(OpNode rightHandSide)
Sets the right hand side of this (in)equation.
|
java.lang.String |
toString()
Returns the String representation of this simple relation.
|
java.lang.String |
toString(java.text.DecimalFormat format)
The
string representation with respect to the given decimal format. |
children, compareTo, extractNode, getChildren, getFalseFor, getFirstChildOfType, getParent, getRelation, getSimpleRelations, getSubrelations, getTrueFor, insertNode, insertNodes, parent, parenthesesNeeded, setChildren, setChildren, setParent, setParent, setRelation
contains, extractNode, getDepth, getNumberClass, insertNode, replace, replaceByValue, replaceWith
protected Operation m_leftHandSide
protected Operation m_rightHandSide
protected int m_normalForm
net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_NONE
,
net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_REL
,
net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_OP
and net.mumie.mathletfactory.algebra.rel.Relation#NORMALIZE_OP_SEPARATED
.protected java.lang.String m_relationSign
net.mumie.mathletfactory.algebra.rel.Relation
.public SimpleRel(java.lang.Class numberClass, java.lang.String expression, int normalForm)
normalForm
as flag, whether the left and right hand side
should be normalized.public SimpleRel(Operation leftHandSide, Operation rightHandSide, java.lang.String relationSign, int normalform)
public SimpleRel(SimpleRel relation)
public SimpleRel(Operation leftHandSide, java.lang.String relationSign)
public SimpleRel(Operation leftHandSide, java.lang.String rightHandSide, java.lang.String relationSign)
public void setLeftHandSide(Operation leftHandSide)
public void setLeftHandSide(OpNode leftHandSide)
public void setRightHandSide(Operation rightHandSide)
public void setRightHandSide(OpNode rightHandSide)
public void setRelationSign(java.lang.String sign)
public java.lang.String getRelationSign()
public Operation getLeftHandSide()
public Operation getRightHandSide()
public void separateFor(java.lang.String string)
separateFor
in class RelNode
public void parse(java.lang.String relationString)
public boolean evaluate(MNumber[] assignedValues)
java.lang.IllegalArgumentException
- if not all the variables are assigend
with values.public boolean evaluate(java.util.HashMap variableValues)
public boolean evaluateFast()
RelNode
evaluateFast
in class RelNode
net.mumie.mathletfactory.algebra.rel.Relation#evaluateFast
public java.util.HashSet getUsedVariables(java.util.HashSet usedVariables)
getUsedVariables
in class RelNode
public java.util.HashMap getVariableOps()
net.mumie.mathletfactory.algebra.op.node.VariableOp
s as values.public java.lang.String toString(java.text.DecimalFormat format)
string
representation with respect to the given decimal format.public java.lang.String toString()
toString
in class java.lang.Object
public void setNormalForm(int normalForm)
setNormalForm
in class RelNode
public void normalizeOp()
public RelNode negate(boolean deepCopy)
public SimpleRel negated()
negate(boolean)
public int getNormalForm()
getNormalForm
in class RelNode
public int getDepth(boolean opNodesCount)
opNodesCount
is set to true, the
net.mumie.mathletfactory.algebra.op.node.OpNode
s do of
SimpleRel
s also count as tree nodes.public boolean isLeaf()
RelNode
public java.lang.Object clone()
public Interval[] getIntervalsTrue(double epsilon, Interval interval)
getIntervalsTrue
in class RelNode
public Interval[] getIntervalsFalse(double epsilon, Interval interval)
getIntervalsFalse
in class RelNode
public boolean includes(SimpleRel aRel)
public boolean equals(java.lang.Object shouldBeASimpleRel)
equals
in class RelNode
includes(net.mumie.mathletfactory.math.algebra.rel.node.SimpleRel)
Further documentation and examples can be found under www.mathletfactory.de.