com.hammurapi.reasoning.spi
Annotation Type Condition


@Target(value={METHOD,PARAMETER})
@Retention(value=RUNTIME)
public @interface Condition

Condition annotation can be used instead of accept methods for parameters and if () blocks inside infer methods.

Author:
Pavel

Required Element Summary
 String[] value
          Condition definition has the following format [parameter list:] condition expression.
 
Optional Element Summary
 double cost
          Cost of condition evaluation.
 

Element Detail

value

public abstract String[] value
Condition definition has the following format [parameter list:] condition expression. Parameter list is a comma separated list of parameter names, parameters not used in the condition expression can be omitted. E.g. parent, child, sibling or, if child is not used in the condition expression parent,,sibling. If parameter list is omitted, then arguments are named arg0, arg1, etc. for method level conditions and arg for parameter level conditions. Condition expression is a fragment of Java code returning boolean. Rule instance is available through rule parameter.

Returns:
True if condition is fulfilled and further rule evaluation shall be attempted. If several conditions are specified, then they are connected by AND and it is assumed that they can be reordered by the rule compilation/execution engine to build conditions chain.

cost

public abstract double cost
Cost of condition evaluation. This cost can be used by rule compilation/execution engine to optimize condition order.

Returns:
Default:
1.0