|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectschema2template.model.MSVExpressionIterator
public final class MSVExpressionIterator
Iterates through the MSV expression tree. Traversing the MSV Tree structure by 1) First trying to get the child (going as deep as possible) 2) Second if no child is available, trying to get the next sibling 3) If no sibling available, get a sibling of the parent (going back to step 1)
Also has the ability to limit iteration to given subclasses and to limit subtree to the next element expressions below.
Field Summary | |
---|---|
static boolean |
ALL_SUBTREE
|
static boolean |
DIRECT_CHILDREN_ONLY
|
int |
mCurrentExpressionDepth
|
Constructor Summary | |
---|---|
MSVExpressionIterator(com.sun.msv.grammar.Expression root)
Iterate through the expression tree |
|
MSVExpressionIterator(com.sun.msv.grammar.Expression root,
Class desiredExpression)
Iterate through the expression tree, but only return objects of desiredExpression |
|
MSVExpressionIterator(com.sun.msv.grammar.Expression root,
Class desiredExpression,
boolean onlyChildren)
Iterate..., but only return objects of desiredExpression and (if not onlyChildren) don't go to children of ElementExp elements (this does not concern root node!). |
Method Summary | |
---|---|
static String |
dumpMSVExpressionTree(com.sun.msv.grammar.Expression rootExpression)
|
int |
getDepth()
|
boolean |
hasNext()
|
com.sun.msv.grammar.Expression |
next()
|
void |
remove()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int mCurrentExpressionDepth
public static final boolean ALL_SUBTREE
public static final boolean DIRECT_CHILDREN_ONLY
Constructor Detail |
---|
public MSVExpressionIterator(com.sun.msv.grammar.Expression root)
root
- Expression rootpublic MSVExpressionIterator(com.sun.msv.grammar.Expression root, Class desiredExpression)
root
- Expression rootdesiredExpression
- Limit returned expressions to subclasses of desiredExpressionpublic MSVExpressionIterator(com.sun.msv.grammar.Expression root, Class desiredExpression, boolean onlyChildren)
Example: Root is table:table. If you choose onlyChildren=false and to limit desiredExpression=ElementExp.class, then you will get all direct element children of table:table, like table:table-row. But you won't get the children of table:table-row.
root
- Expression rootdesiredExpression
- Limit returned expressions to subclasses of desiredExpressiononlyChildren
- if only children should be returnedMethod Detail |
---|
public int getDepth()
public static String dumpMSVExpressionTree(com.sun.msv.grammar.Expression rootExpression) throws Exception
Exception
public boolean hasNext()
hasNext
in interface Iterator<com.sun.msv.grammar.Expression>
public com.sun.msv.grammar.Expression next()
next
in interface Iterator<com.sun.msv.grammar.Expression>
public void remove()
remove
in interface Iterator<com.sun.msv.grammar.Expression>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |