public class ENodeServices
System services for ENode elements.
Constructor Summary | |
---|---|
ENodeServices()
|
Method Summary | |
---|---|
fr.obeo.acceleo.gen.template.eval.ENode |
cast(fr.obeo.acceleo.gen.template.eval.ENode node,
java.lang.String type)
Gets all the nodes whose type is the given type. |
fr.obeo.acceleo.gen.template.eval.ENode |
current(fr.obeo.acceleo.gen.template.eval.ENode node)
Returns the current node. |
fr.obeo.acceleo.gen.template.eval.ENode |
filter(fr.obeo.acceleo.gen.template.eval.ENode node,
java.lang.String type)
Gets all the nodes whose type is the given type. |
fr.obeo.acceleo.gen.template.eval.ENode |
minimize(fr.obeo.acceleo.gen.template.eval.ENode node)
Removes all duplicated nodes. |
fr.obeo.acceleo.gen.template.eval.ENode |
nGet(fr.obeo.acceleo.gen.template.eval.ENode node,
int index)
Returns the child node at the given index in the current node. |
fr.obeo.acceleo.gen.template.eval.ENode |
nGet(fr.obeo.acceleo.gen.template.eval.ENode node,
java.lang.String key)
Gets the node for the given key in the context. |
fr.obeo.acceleo.gen.template.eval.ENode |
nPeek(fr.obeo.acceleo.gen.template.eval.ENode node)
Return the last node pushed into the context, and returns an empty string. |
void |
nPop(fr.obeo.acceleo.gen.template.eval.ENode node)
Pops the context, and returns an empty string. |
void |
nPush(fr.obeo.acceleo.gen.template.eval.ENode node)
Pushes the current node into the context, and returns an empty string. |
void |
nPut(fr.obeo.acceleo.gen.template.eval.ENode node,
java.lang.String key)
Puts the current node in the context for the given key, and return an empty string. |
int |
nSize(fr.obeo.acceleo.gen.template.eval.ENode node)
Returns the size of the node. |
fr.obeo.acceleo.gen.template.eval.ENode |
sep(fr.obeo.acceleo.gen.template.eval.ENode node,
java.lang.String separator)
Add a separator between each element of the list. |
fr.obeo.acceleo.gen.template.eval.ENode |
sort(fr.obeo.acceleo.gen.template.eval.ENode node)
Sorts the node and its children. |
fr.obeo.acceleo.gen.template.eval.ENode |
toString(fr.obeo.acceleo.gen.template.eval.ENode node)
Transforms the node into a string. |
fr.obeo.acceleo.gen.template.eval.ENode |
until(fr.obeo.acceleo.gen.template.eval.ENode node,
java.lang.String link,
java.lang.String type)
Get recursively the feature value of an object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ENodeServices()
Method Detail |
---|
public fr.obeo.acceleo.gen.template.eval.ENode cast(fr.obeo.acceleo.gen.template.eval.ENode node, java.lang.String type) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException, fr.obeo.acceleo.ecore.factories.FactoryException
An element is kept only if it's an EObject whose type is the given type or if it isn't an EObject.
Sample :
If type equals "A" and node is a list {a, "\n", b, c}
the result is a list {a, "\n", b}.
node
- is the listtype
- is the type kept
fr.obeo.acceleo.gen.template.eval.ENodeCastException
- if the given node isn't a list
fr.obeo.acceleo.ecore.factories.FactoryException
public fr.obeo.acceleo.gen.template.eval.ENode current(fr.obeo.acceleo.gen.template.eval.ENode node)
node
- is the current node
public fr.obeo.acceleo.gen.template.eval.ENode filter(fr.obeo.acceleo.gen.template.eval.ENode node, java.lang.String type) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException, fr.obeo.acceleo.ecore.factories.FactoryException
An element is kept only if it's an EObject whose type is the given type or if it isn't an EObject.
Sample :
If type equals "A" and node is a list {a, "\n", b, c}
the result is a list {a, "\n", b}.
node
- is the listtype
- is the type kept
fr.obeo.acceleo.gen.template.eval.ENodeCastException
- if the given node isn't a list
fr.obeo.acceleo.ecore.factories.FactoryException
public fr.obeo.acceleo.gen.template.eval.ENode minimize(fr.obeo.acceleo.gen.template.eval.ENode node) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException
node
- is the current node
fr.obeo.acceleo.gen.template.eval.ENodeCastException
public fr.obeo.acceleo.gen.template.eval.ENode nGet(fr.obeo.acceleo.gen.template.eval.ENode node, int index) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException, fr.obeo.acceleo.ecore.factories.FactoryException
node
- is the current nodeindex
- is the index of the child
fr.obeo.acceleo.gen.template.eval.ENodeCastException
fr.obeo.acceleo.ecore.factories.FactoryException
public fr.obeo.acceleo.gen.template.eval.ENode nGet(fr.obeo.acceleo.gen.template.eval.ENode node, java.lang.String key)
node
- is the current nodekey
- is the key in the context
public fr.obeo.acceleo.gen.template.eval.ENode nPeek(fr.obeo.acceleo.gen.template.eval.ENode node)
node
- is the current node
public void nPop(fr.obeo.acceleo.gen.template.eval.ENode node)
node
- is the current nodepublic void nPush(fr.obeo.acceleo.gen.template.eval.ENode node)
node
- is the current nodepublic void nPut(fr.obeo.acceleo.gen.template.eval.ENode node, java.lang.String key)
node
- is the current nodekey
- is the key in the contextpublic int nSize(fr.obeo.acceleo.gen.template.eval.ENode node)
node
- is the current node
public fr.obeo.acceleo.gen.template.eval.ENode sep(fr.obeo.acceleo.gen.template.eval.ENode node, java.lang.String separator) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException, fr.obeo.acceleo.ecore.factories.FactoryException
Sample :
If separator equals "\t" and node is a list {a, b, c} the result is a list {a, "\t", b, "\t", c}.
node
- is the listseparator
- is the separator
fr.obeo.acceleo.gen.template.eval.ENodeCastException
- if the given node isn't a list
fr.obeo.acceleo.ecore.factories.FactoryException
public fr.obeo.acceleo.gen.template.eval.ENode sort(fr.obeo.acceleo.gen.template.eval.ENode node) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException
node
- is the current node
fr.obeo.acceleo.gen.template.eval.ENodeCastException
public fr.obeo.acceleo.gen.template.eval.ENode toString(fr.obeo.acceleo.gen.template.eval.ENode node)
node
- is the current node
public fr.obeo.acceleo.gen.template.eval.ENode until(fr.obeo.acceleo.gen.template.eval.ENode node, java.lang.String link, java.lang.String type) throws fr.obeo.acceleo.gen.template.eval.ENodeCastException, fr.obeo.acceleo.ecore.factories.FactoryException
The given node must be an EObject.
Sample :
until(c,"container","A") returns a
until(b,"container","A") returns a
until(a,"container","A") returns a
until(b,"container","C") returns null
node
- is an EObjectlink
- is the feature nametype
- is the type which stops the recursivity
fr.obeo.acceleo.gen.template.eval.ENodeCastException
- if the given node isn't an EObject
fr.obeo.acceleo.ecore.factories.FactoryException