net.sourceforge.nrl.parser.ast.impl
Class RuleSetDeclarationImpl

java.lang.Object
  extended by org.antlr.runtime.tree.BaseTree
      extended by org.antlr.runtime.tree.CommonTree
          extended by net.sourceforge.nrl.parser.ast.impl.Antlr3NRLBaseAst
              extended by net.sourceforge.nrl.parser.ast.impl.RuleSetDeclarationImpl
All Implemented Interfaces:
INRLAstNode, IRuleSetDeclaration, org.antlr.runtime.tree.Tree

public class RuleSetDeclarationImpl
extends Antlr3NRLBaseAst
implements IRuleSetDeclaration


Field Summary
 
Fields inherited from class org.antlr.runtime.tree.CommonTree
childIndex, parent, startIndex, stopIndex, token
 
Fields inherited from class org.antlr.runtime.tree.BaseTree
children
 
Fields inherited from interface net.sourceforge.nrl.parser.ast.INRLAstNode
NEWLINE
 
Fields inherited from interface org.antlr.runtime.tree.Tree
INVALID_NODE
 
Constructor Summary
RuleSetDeclarationImpl(org.antlr.runtime.Token token)
           
 
Method Summary
 void accept(INRLAstVisitor visitor)
          Accept a visitor to this node.
 void addRule(IRuleDeclaration decl)
          Add a rule to this set.
 String dump(int indent)
          Deprecated. 
 String getId()
          Return the rule set identifier.
 IModelReference getModelReference()
          Helper method - return the raw precondition model reference, for use in resolution.
 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.
 void setContext(IModelElement context)
          Set the model element referenced in the precondition context.
 
Methods inherited from class net.sourceforge.nrl.parser.ast.impl.Antlr3NRLBaseAst
doIndent, getColumn, getLine, getUserData, initialisePositionFromChild, setColumn, setLine, setUserData
 
Methods inherited from class org.antlr.runtime.tree.CommonTree
dupNode, getCharPositionInLine, getChildIndex, getParent, getText, getToken, getTokenStartIndex, getTokenStopIndex, getType, isNil, setChildIndex, setParent, setTokenStartIndex, setTokenStopIndex, setUnknownTokenBoundaries, toString
 
Methods inherited from class org.antlr.runtime.tree.BaseTree
addChild, addChildren, createChildrenList, deleteChild, freshenParentAndChildIndexes, freshenParentAndChildIndexes, getAncestor, getAncestors, getChild, getChildCount, getChildren, getFirstChildWithType, hasAncestor, replaceChildren, sanityCheckParentAndChildIndexes, sanityCheckParentAndChildIndexes, setChild, toStringTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.nrl.parser.ast.INRLAstNode
getColumn, getLine, getUserData, setUserData
 

Constructor Detail

RuleSetDeclarationImpl

public RuleSetDeclarationImpl(org.antlr.runtime.Token token)
Method Detail

accept

public void accept(INRLAstVisitor visitor)
Description copied from interface: INRLAstNode
Accept a visitor to this node.

Specified by:
accept in interface INRLAstNode
Overrides:
accept in class Antlr3NRLBaseAst
Parameters:
visitor - the visitor

dump

@Deprecated
public String dump(int indent)
Deprecated. 

Description copied from interface: INRLAstNode
Dump the AST and its children for debugging purposes

Specified by:
dump in interface INRLAstNode
Overrides:
dump in class Antlr3NRLBaseAst
Parameters:
indent - the indentation count, 0 on first call
Returns:
the AST as a string

getId

public String getId()
Description copied from interface: IRuleSetDeclaration
Return the rule set identifier. This is never null.

Specified by:
getId in interface IRuleSetDeclaration
Returns:
the identifier

getPreconditionConstraint

public IConstraint getPreconditionConstraint()
Description copied from interface: IRuleSetDeclaration
Return the precondition constraint, if there is one. If this returns a constraint, then IRuleSetDeclaration.getPreconditionContext() will return a value too.

Specified by:
getPreconditionConstraint in interface IRuleSetDeclaration
Returns:
the constraint or null

getPreconditionContext

public IModelElement getPreconditionContext()
Description copied from interface: IRuleSetDeclaration
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 IRuleSetDeclaration.getPreconditionConstraint() will too.

Specified by:
getPreconditionContext in interface IRuleSetDeclaration
Returns:
the precondition context or null

getRules

public List<IRuleDeclaration> getRules()
Description copied from interface: IRuleSetDeclaration
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.

Specified by:
getRules in interface IRuleSetDeclaration
Returns:
the rules

addRule

public void addRule(IRuleDeclaration decl)
Add a rule to this set. Used by the resolver

Parameters:
decl - the rule

getModelReference

public IModelReference getModelReference()
Helper method - return the raw precondition model reference, for use in resolution. Returns null if no precondition

Returns:
the reference

setContext

public void setContext(IModelElement context)
Set the model element referenced in the precondition context. Used by a resolver only if there is a precondition.

Parameters:
context - the context to set


Copyright © 2006-2013. All Rights Reserved.