package evaluate
- Alphabetic
- Public
- Protected
Type Members
- trait CompositionOperator extends Operator
Defines interface of class/object that defines a composition operator.
Defines interface of class/object that defines a composition operator. Unlike other operators, these operators are more complex and new to inform sub-nodes in syntax tree of values before evaluating its current node. This is performed by updating the map "logicOperatorToValue" which is passed on to sub-nodes. Invoked method has to be "composeOperator" and overloading this method doesn't work.
map, filter, all, none, some
Example: - class EvaluatorLogic extends AnyRef
Responsible for evaluating scala data structure com.celadari.jsonlogicscala.tree.JsonLogicCore.
Responsible for evaluating scala data structure com.celadari.jsonlogicscala.tree.JsonLogicCore. May be extended to fit custom use cases. Providing the right configuration via com.celadari.jsonlogicscala.evaluate.EvaluatorLogicConf is enough to cover most cases. You may redefine methods to handle extreme uncommon cases.
- case class EvaluatorLogicConf(operatorToMethodConfMetaInfAdd: Map[String, MethodConf], operatorToMethodConfManualAdd: Map[String, MethodConf], valueLogicTypeToReducerMetaInfAdd: Map[TypeValue, EvaluatorValueLogic], valueLogicTypeToReducerManualAdd: Map[TypeValue, EvaluatorValueLogic], isPriorityToManualAdd: Boolean = true) extends Product with Serializable
Represents an evaluator's configuration.
Represents an evaluator's configuration. It informs the evaluator how to map an operator_codename to an actual method.
- trait EvaluatorValueLogic extends AnyRef
Defines interface of class/object that defines an evaluator_value_logic.
Defines interface of class/object that defines an evaluator_value_logic. A class|object implementing this interface is called before evaluation and transforms leaf values in syntax tree.
AND / \ < < / \ / \ A 5 B -4
if you define an evaluator_value_logic defined for int values and returns absolute value then evaluation will be on the following tree
AND / \ < < / \ / \ A 5 B 4
- case class MethodConf(operator: String, methodName: String, ownerMethodOpt: Option[Operator], isReduceTypeOperator: Boolean = true, isCompositionOperator: Boolean = false, isUnaryOperator: Boolean = false) extends Product with Serializable
Represents an operator's information for evaluation.
- class MethodSignatureFinder extends AnyRef
Responsible for finding paths of a compatible classes in case there exists multiple overloaded method versions of operator's method.
Responsible for finding paths of a compatible classes in case there exists multiple overloaded method versions of operator's method.
class A, class B extends A conditionsValues(a, b, c) (a object of A, b object of B, c object of C) overloaded methods have the following signatures: overloaded_method(A, A): B overloaded_method(A, B): A overloaded_method(A, C): D overloaded_method(A, D): A overloaded_method(B, A): A overloaded_method(B, C): A overloaded_method(D, C): A then compatible paths are Array((overloaded_method(A, A): B), (overloaded_method(B, C): A)) Array((overloaded_method(A, B): A), (overloaded_method(A, C): D)) This search is used on reduce type operators as conditions might not be the same type and which overloaded method to be applied must be found before evaluation.
Example: - trait Operator extends AnyRef
Defines interface of class/object that defines an operator.
Defines interface of class/object that defines an operator. There is no constraint on method name. Name of invoked method during evaluation is known in com.celadari.jsonlogicscala.evaluate.MethodConf configuration.
- trait UnaryOperator extends Operator
Defines interface of class/object that defines an unary operator.
Defines interface of class/object that defines an unary operator. Unlike binary|multiple input operators, unary operators take only one input. Invoked method has to be "unaryOperator" and overloading this method doesn't work.
negate operator, getOrDefaultOperator
Example:
Value Members
- object CompositionOperator
Companion object containing class com.celadari.jsonlogicscala.evaluate.CompositionOperator.ComposeJsonLogicCore's definition.
- object EvaluatorLogicConf extends Serializable
Companion object to hold implicit: com.celadari.jsonlogicscala.evaluate.EvaluatorLogicConf, mapping of default operators (type_codename -> method_conf), and method to create a custom configuration.
- object EvaluatorValueLogic
Companion object to hold default com.celadari.jsonlogicscala.evaluate.EvaluatorValueLogic.
- object MethodSignatureFinder
Companion object that defines utility function to find minimum (class inheritance as partial order) classes among set of classes.