net.sourceforge.nrl.parser.ast
Interface IRuleSetDeclaration

All Superinterfaces:
INRLAstNode

public interface IRuleSetDeclaration
extends INRLAstNode

A rule set is a named collection of rules, with an optional precondition attached to the execution of the rules.

The semantics of a rule set is such that the precondition is evaluated first. If the precondition evaluates to true, the rules in the rule set are executed, otherwise they are not executed. If there is no precondition, the rule set always executes.

The precondition of a rule set is evaluated relative to a context, the same way that a rule is evaluated relative to a context. For example:

         RuleSet "old trades"
         Applies if Trade has a tradedate before '2005-02-17'
 

In this example, all rules in the NRL file following the rule set declaration (but before the next rule set declaration) are executed only if in the input data, the context (Trade) fulfils the constraint.


Field Summary
 
Fields inherited from interface net.sourceforge.nrl.parser.ast.INRLAstNode
NEWLINE
 
Method Summary
 String getId()
          Return the rule set identifier.
 IConstraint getPreconditionConstraint()
          Return the precondition constraint, if there is one.
 IModelElement getPreconditionContext()
          Return the precondition context, if there is one.
 List<IRuleDeclaration> getRules()
          Return the rules in this rule set.
 
Methods inherited from interface net.sourceforge.nrl.parser.ast.INRLAstNode
accept, dump, getColumn, getLine, getUserData, setUserData
 

Method Detail

getId

String getId()
Return the rule set identifier. This is never null.

Returns:
the identifier

getPreconditionContext

IModelElement getPreconditionContext()
Return the precondition context, if there is one. Otherwise, return null. Can only be called after resolving against a model. If this returns a value, then getPreconditionConstraint() will too.

Returns:
the precondition context or null

getPreconditionConstraint

IConstraint getPreconditionConstraint()
Return the precondition constraint, if there is one. If this returns a constraint, then getPreconditionContext() will return a value too.

Returns:
the constraint or null

getRules

List<IRuleDeclaration> getRules()
Return the rules in this rule set. This returns a set of IRuleDeclaration objects. This can only be called once the AST has been fully resolved.

Returns:
the rules


Copyright © 2006-2010 Christian Nentwich and others