|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor
public class ValidationFragmentDependencyProcessor
A dependency processor that can be fed with a number of fragment declarations, and returns them in dependency order. Properties with no dependencies will be returned first.
This class enables the type checker to determine a processing order, because fragment types cannot determined until types of properties referenced within them are clear.
The class also detects circular fragment references. Here is how to use it:
addDeclaration(IDeclaration)
repeatedly
resolve()
and abort if necessary
getOrderedDeclarations()
Constructor Summary | |
---|---|
ValidationFragmentDependencyProcessor()
|
Method Summary | |
---|---|
void |
addDeclaration(IDeclaration decl)
|
void |
addDeclaration(IValidationFragmentDeclaration decl)
|
void |
addDeclarations(IRuleFile file)
|
protected Collection<net.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor.DependencyNode> |
buildDependencyGraph()
Build the graph of DependencyNode objects. |
protected void |
depthFirst(net.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor.DependencyNode root,
Collection<net.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor.DependencyNode> removalList)
Traverse from a node, and add all encountered nodes to the orderedDeclarations list. |
List<IDeclaration> |
getOrderedDeclarations()
|
protected List<IDeclaration> |
getReferencedDeclarations(IDeclaration decl)
Given a declaration, return a list of declarations it references. |
List<NRLError> |
resolve()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValidationFragmentDependencyProcessor()
Method Detail |
---|
public void addDeclaration(IValidationFragmentDeclaration decl)
public void addDeclaration(IDeclaration decl)
public void addDeclarations(IRuleFile file)
public List<NRLError> resolve()
protected void depthFirst(net.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor.DependencyNode root, Collection<net.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor.DependencyNode> removalList)
root
- the root noderemovalList
- the list to remove fromprotected Collection<net.sourceforge.nrl.parser.ast.constraints.impl.ValidationFragmentDependencyProcessor.DependencyNode> buildDependencyGraph()
protected List<IDeclaration> getReferencedDeclarations(IDeclaration decl)
decl
- the declarations
public List<IDeclaration> getOrderedDeclarations()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |