com.hammurapi.reasoning.impl
Class RuleSetToFlowCompiler

java.lang.Object
  extended by com.hammurapi.reasoning.impl.RuleSetToFlowCompiler
All Implemented Interfaces:
Constants

public class RuleSetToFlowCompiler
extends Object
implements Constants

Compiles (transforms) rule set to flow definition.

Author:
Pavel Vlasov

Field Summary
 
Fields inherited from interface com.hammurapi.reasoning.impl.Constants
CONDITION_NO, DEFAULT, INPUT, LINE_SEPARATOR, OUTPUT, PUT, RULE_INDEX
 
Constructor Summary
RuleSetToFlowCompiler()
           
 
Method Summary
 Flow compile(RuleSet source, FactoryConfig factoryConfig)
          Compiles rule set to flow.
protected  Node createInferenceMethodNode(RuleSet ruleSet, Rule rule, Method method, Flow owner)
          Creates inference method node.
protected  Node createNode(Flow flow, Class<?> type)
           
protected  Infer getInferAnnotation(Method method)
          Extracts inference information from the method.
static void main(String[] args)
           
protected static void printDiagnostic(org.eclipse.emf.common.util.Diagnostic diagnostic, String indent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RuleSetToFlowCompiler

public RuleSetToFlowCompiler()
Method Detail

compile

public Flow compile(RuleSet source,
                    FactoryConfig factoryConfig)
             throws ConfigurationException
Compiles rule set to flow.

Parameters:
ruleSet - Rule set. The rule set gets modified during compilation and shall be discarded after compilation.
classLoader - Classloader to load rule classes for introspection. If null, then this class' classloader is used.
Returns:
Flow definition.
Throws:
ConfigurationException

createInferenceMethodNode

protected Node createInferenceMethodNode(RuleSet ruleSet,
                                         Rule rule,
                                         Method method,
                                         Flow owner)
Creates inference method node. Subclasses can override this method to provide custom node implementations and additional configuration.

Parameters:
method -
rule -
ruleSet -
ret -
Returns:

getInferAnnotation

protected Infer getInferAnnotation(Method method)
Extracts inference information from the method. This implementation takes it from Infer annotation. Subclasses can do it in a different way.

Parameters:
method -
Returns:

createNode

protected Node createNode(Flow flow,
                          Class<?> type)

main

public static void main(String[] args)
                 throws Exception
Parameters:
args -
Throws:
Exception

printDiagnostic

protected static void printDiagnostic(org.eclipse.emf.common.util.Diagnostic diagnostic,
                                      String indent)