Class ConstraintEvaluator
- java.lang.Object
-
- jadex.rules.rulesystem.rete.constraints.ConstraintEvaluator
-
- All Implemented Interfaces:
IConstraintEvaluator
public class ConstraintEvaluator extends java.lang.Object implements IConstraintEvaluator
A constraint evaluator is responsible for evaluating constraints. It operates on an operator and two extractors. It uses the extractors to fetch the values and invokes the operator subsequently with the values.
-
-
Field Summary
Fields Modifier and Type Field Description protected IValueExtractor
extractor1
The value extractor 1.protected IValueExtractor
extractor2
The value extractor 2.protected IOperator
operator
The operator.
-
Constructor Summary
Constructors Constructor Description ConstraintEvaluator(IOperator operator, IValueExtractor extractor1, IValueExtractor extractor2)
Create a new constraint evaluator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Test if the evaluator equals an object.boolean
evaluate(java.lang.Object right, Tuple left, IOAVState state)
Evaluate the constraints given the right object, left tuple (null for alpha nodes) and the state.IValueExtractor
getExtractor1()
Get the first value extractor.IValueExtractor
getExtractor2()
Get the second value extractor.AttributeSet
getIndirectAttributes()
Get the set of indirect attribute types.IOperator
getOperator()
Get the operator.AttributeSet
getRelevantAttributes()
Get the set of relevant attribute types.int
hashCode()
Get the hash code.boolean
isAffected(int tupleindex, OAVAttributeType attr)
Test if a constraint evaluator is affected from a change of a certain attribute.java.lang.String
toString()
Get the string representation.
-
-
-
Field Detail
-
operator
protected IOperator operator
The operator.
-
extractor1
protected IValueExtractor extractor1
The value extractor 1.
-
extractor2
protected IValueExtractor extractor2
The value extractor 2.
-
-
Constructor Detail
-
ConstraintEvaluator
public ConstraintEvaluator(IOperator operator, IValueExtractor extractor1, IValueExtractor extractor2)
Create a new constraint evaluator.- Parameters:
operator
- The operator.extractor1
- The first extractor.extractor2
- The second extractor.
-
-
Method Detail
-
evaluate
public boolean evaluate(java.lang.Object right, Tuple left, IOAVState state)
Evaluate the constraints given the right object, left tuple (null for alpha nodes) and the state.- Specified by:
evaluate
in interfaceIConstraintEvaluator
- Parameters:
right
- The right input object.left
- The left input tuple.state
- The working memory.
-
isAffected
public boolean isAffected(int tupleindex, OAVAttributeType attr)
Test if a constraint evaluator is affected from a change of a certain attribute.- Specified by:
isAffected
in interfaceIConstraintEvaluator
- Parameters:
tupleindex
- The tuple index.attr
- The attribute.- Returns:
- True, if affected.
-
getRelevantAttributes
public AttributeSet getRelevantAttributes()
Get the set of relevant attribute types.- Specified by:
getRelevantAttributes
in interfaceIConstraintEvaluator
-
getIndirectAttributes
public AttributeSet getIndirectAttributes()
Get the set of indirect attribute types. I.e. attributes of objects, which are not part of an object conditions (e.g. for chained extractors)- Specified by:
getIndirectAttributes
in interfaceIConstraintEvaluator
- Returns:
- The relevant attribute types.
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string representation.
-
getOperator
public IOperator getOperator()
Get the operator.
-
getExtractor1
public IValueExtractor getExtractor1()
Get the first value extractor.
-
getExtractor2
public IValueExtractor getExtractor2()
Get the second value extractor.
-
hashCode
public int hashCode()
Get the hash code.- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if the evaluator equals an object.- Overrides:
equals
in classjava.lang.Object
-
-