Package org.hcjf.layers.query.evaluators
Class EvaluatorCollection
- java.lang.Object
-
- org.hcjf.layers.query.evaluators.EvaluatorCollection
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<Evaluator>evaluators
-
Constructor Summary
Constructors Constructor Description EvaluatorCollection()EvaluatorCollection(EvaluatorCollection parent)
-
Method Summary
Modifier and Type Method Description EvaluatorCollectionaddBoolean(java.lang.Object value)Add a particular evaluator that implements the true or false evaluation.EvaluatorCollectionaddEvaluator(Evaluator evaluator)Add an instance of the evaluator object that evaluate if some instance of the data collection must be in the result add or not.EvaluatorCollectionand()Add a group evaluator with 'and' function, by default return evaluate with false.protected EvaluatorcheckEvaluator(Evaluator evaluator)EvaluatorCollectiondistinct(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'distinct' method.EvaluatorCollectionequals(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'equals' method.java.util.Set<Evaluator>getEvaluators()Return the unmodifiable set with evaluators.java.util.Collection<Evaluator>getFieldEvaluators(java.lang.String fieldName, java.lang.Class<? extends FieldEvaluator>... evaluatorType)Return the collection of evaluators that corresponds to provided fieldName and typesEvaluatorCollectiongreaterThan(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'greater than' method.EvaluatorCollectiongreaterThanOrEquals(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'greater than or equals' method.booleanhasEvaluators()Returns false if the collection is empty or all the elements are TrueEvaluator.EvaluatorCollectionin(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'in' method.EvaluatorCollectionlike(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'like' method.EvaluatorCollectionnotIn(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'not in' method.protected booleanonAddEvaluator(Evaluator evaluator)This method is called when some evaluator is added to the collection.EvaluatorCollectionor()Add a group evaluator with 'or' function, by default return evaluate with false.voidremoveEvaluator(Evaluator evaluator)This method remove the evaluator into the collection.EvaluatorCollectionsmallerThan(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'smaller than' method.EvaluatorCollectionsmallerThanOrEqual(java.lang.Object leftValue, java.lang.Object rightValue)Add a particular evaluator that implements 'smaller than or equals' method.EvaluatorCollectionup()Return the parent of the evaluator collection, the parent is other instance of evaluator collection.
-
-
-
Field Detail
-
evaluators
protected final java.util.Set<Evaluator> evaluators
-
-
Constructor Detail
-
EvaluatorCollection
public EvaluatorCollection()
-
EvaluatorCollection
public EvaluatorCollection(EvaluatorCollection parent)
-
-
Method Detail
-
getEvaluators
public final java.util.Set<Evaluator> getEvaluators()
Return the unmodifiable set with evaluators.- Returns:
- Evaluators.
-
hasEvaluators
public boolean hasEvaluators()
Returns false if the collection is empty or all the elements are TrueEvaluator. It is used on reduced queries to check if there are still some evaluators to eval.- Returns:
- true if the collection is not empty and there is at least one evaluator not instance of TrueEvaluator.
-
up
public final EvaluatorCollection up()
Return the parent of the evaluator collection, the parent is other instance of evaluator collection.- Returns:
- Parent of the collection, could be null.
-
removeEvaluator
public void removeEvaluator(Evaluator evaluator)
This method remove the evaluator into the collection.- Parameters:
evaluator- Evaluator to remove.
-
addEvaluator
public final EvaluatorCollection addEvaluator(Evaluator evaluator)
Add an instance of the evaluator object that evaluate if some instance of the data collection must be in the result add or not.- Parameters:
evaluator- FieldEvaluator instance.- Returns:
- Return the same instance of this class.
- Throws:
java.lang.IllegalArgumentException- If the instance of the evaluator is null.
-
onAddEvaluator
protected boolean onAddEvaluator(Evaluator evaluator)
This method is called when some evaluator is added to the collection.- Parameters:
evaluator- Evaluator added.- Returns:
- True if the evaluator must be added into the evaluator collection.
-
getFieldEvaluators
public java.util.Collection<Evaluator> getFieldEvaluators(java.lang.String fieldName, java.lang.Class<? extends FieldEvaluator>... evaluatorType)
Return the collection of evaluators that corresponds to provided fieldName and types- Parameters:
fieldName- Field name.evaluatorType- Evaluator types.- Returns:
- collection of evaluators
-
addBoolean
public final EvaluatorCollection addBoolean(java.lang.Object value)
Add a particular evaluator that implements the true or false evaluation.- Parameters:
value- Object to obtain the boolean value.- Returns:
- Return the same instance of this class.
-
distinct
public final EvaluatorCollection distinct(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'distinct' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
equals
public final EvaluatorCollection equals(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'equals' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
greaterThan
public final EvaluatorCollection greaterThan(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'greater than' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
greaterThanOrEquals
public final EvaluatorCollection greaterThanOrEquals(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'greater than or equals' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
in
public final EvaluatorCollection in(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'in' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
notIn
public final EvaluatorCollection notIn(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'not in' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
smallerThan
public final EvaluatorCollection smallerThan(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'smaller than' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
smallerThanOrEqual
public final EvaluatorCollection smallerThanOrEqual(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'smaller than or equals' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
like
public final EvaluatorCollection like(java.lang.Object leftValue, java.lang.Object rightValue)
Add a particular evaluator that implements 'like' method.- Parameters:
leftValue- Left value of the operation.rightValue- Right value of the operation.- Returns:
- Return the same instance of this class.
-
or
public final EvaluatorCollection or()
Add a group evaluator with 'or' function, by default return evaluate with false.- Returns:
- Return the instance of the new evaluator collection (or instance);
-
and
public final EvaluatorCollection and()
Add a group evaluator with 'and' function, by default return evaluate with false.- Returns:
- Return the instance of the new evaluator collection (and instance);
-
-