Class BaseNode
java.lang.Object
de.fraunhofer.iosb.ilt.frostserver.util.pathparser.nodes.BaseNode
- All Implemented Interfaces:
de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node,Iterable<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>,Collection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>,List<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>
- Direct Known Subclasses:
P_EntityId,P_PathElement,Start
public class BaseNode
extends Object
implements de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
The base concrete class for non-terminal Nodes
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node.NodeType, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node.TerminalNode, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node.Visitor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) booleanadd(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) booleanaddAll(int i, Collection<? extends de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node> nodes) booleanaddAll(Collection<? extends de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node> nodes) voidaddChild(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) inserts a child Node at a specific index, displacing the nodes after the index by 1.voidaddChild(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) appends a child NodevoidaddToNamedChildList(String name, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node node) List<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>children()voidclear()voidRemove all the child nodesbooleancontainsAll(Collection<?> nodes) de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Nodeget(int i) intde.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodegetChild(int i) intintde.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodegetNamedChild(String name) List<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>getNamedChildList(String name) de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Token>de.fraunhofer.iosb.ilt.frostserver.util.pathparser.PLexerbooleande.fraunhofer.iosb.ilt.frostserver.util.pathparser.Noderemove(int i) booleanremoveAll(Collection<?> nodes) de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NoderemoveChild(int i) Remove the node at index i.booleanretainAll(Collection<?> nodes) de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Nodeset(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) voidsetBeginOffset(int beginOffset) Set the offset where the token begins, expressed in code units.voidsetChild(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) Replace the node at index ivoidsetEndOffset(int endOffset) Set the offset where the token ends, actually the location where the very next token should begin.static voidsetListClass(Class<? extends List> listClass) Sets the List class that is used to store child nodes.voidsetNamedChild(String name, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node node) voidsetParent(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) voidsetTokenSource(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.TokenSource tokenSource) voidsetUnparsed(boolean unparsed) Mark whether this Node is unparsed, i.e.List<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>subList(int from, int to) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliteratorMethods inherited from interface de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
appendChild, children, childrenOfType, childrenOfType, childrenOfType, childrenOfType, close, contains, copyLocationInfo, copyLocationInfo, descendants, descendants, descendants, descendants, descendantsOfType, descendantsOfType, dump, dump, firstAncestorOfType, firstChildOfType, firstChildOfType, firstChildOfType, firstDescendantOfType, firstDescendantOfType, firstDescendantOfType, firstDescendantOfType, getAllTokens, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getFirstChild, getImage, getInputSource, getLastChild, getLength, getLocation, getRoot, getSource, getTokenType, getType, hasChildNodes, indexOf, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextSibling, open, prependChild, previousSibling, remove, removeChild, replace, replace, replaceChild, size, toArray, toArray
-
Constructor Details
-
BaseNode
public BaseNode()
-
-
Method Details
-
getTokenSource
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.PLexer getTokenSource()- Specified by:
getTokenSourcein interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Returns:
- the #TokenSource from which this Node object originated. There is no guarantee that this doesn't return null. Most likely that would simply be because you constructed the Node yourself, i.e. it didn't really come about via the parsing/tokenizing machinery.
-
setTokenSource
public void setTokenSource(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.TokenSource tokenSource) - Specified by:
setTokenSourcein interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
setListClass
Sets the List class that is used to store child nodes. By default, this is java.util.ArrayList. There is probably very little reason to ever use anything else, though you could use this method to replace this with LinkedList or your own java.util.List implementation even.- Parameters:
listClass- the #java.util.List implementation to use internally for the child nodes. By default #java.util.ArrayList is used.
-
isUnparsed
public boolean isUnparsed()- Specified by:
isUnparsedin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Returns:
- whether this Node was created by regular operations of the parsing machinery.
-
setUnparsed
public void setUnparsed(boolean unparsed) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeMark whether this Node is unparsed, i.e. not the result of normal parsing- Specified by:
setUnparsedin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Parameters:
unparsed- whether to set the Node as unparsed or parsed.
-
setParent
public void setParent(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) - Specified by:
setParentin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Parameters:
n- The Node to set as the parent. Mostly used internally. The various addChild or appendChild sorts of methods should use this to set the node's parent.
-
getParent
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node getParent()- Specified by:
getParentin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Returns:
- this node's parent Node
-
addChild
public void addChild(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Nodeappends a child Node- Specified by:
addChildin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
addChild
public void addChild(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Nodeinserts a child Node at a specific index, displacing the nodes after the index by 1.- Specified by:
addChildin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Parameters:
i- the (zero-based) index at which to insert the noden- the Node to insert
-
getChild
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node getChild(int i) - Specified by:
getChildin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Parameters:
i- the index of the Node to return- Returns:
- the Node at the specific offset
-
setChild
public void setChild(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeReplace the node at index i- Specified by:
setChildin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Parameters:
i- the indexn- the node
-
removeChild
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node removeChild(int i) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeRemove the node at index i. Any Nodes after i are shifted to the left.- Specified by:
removeChildin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Parameters:
i- the index at which to remove- Returns:
- the removed Node
-
remove
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node remove(int i) -
clearChildren
public void clearChildren()Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeRemove all the child nodes- Specified by:
clearChildrenin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
getChildCount
public int getChildCount()- Specified by:
getChildCountin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Returns:
- the number of child nodes
-
children
- Specified by:
childrenin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
getBeginOffset
public int getBeginOffset()- Specified by:
getBeginOffsetin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Returns:
- the offset in the input source where the token begins, expressed in code units.
-
setBeginOffset
public void setBeginOffset(int beginOffset) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeSet the offset where the token begins, expressed in code units.- Specified by:
setBeginOffsetin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
getEndOffset
public int getEndOffset()- Specified by:
getEndOffsetin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node- Returns:
- the offset in the input source where the token ends, expressed in code units. This is actually the offset where the very next token would begin.
-
setEndOffset
public void setEndOffset(int endOffset) Description copied from interface:de.fraunhofer.iosb.ilt.frostserver.util.pathparser.NodeSet the offset where the token ends, actually the location where the very next token should begin.- Specified by:
setEndOffsetin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
subList
-
getRealTokens
-
add
public void add(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) -
get
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node get(int i) -
set
public de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node set(int i, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) -
add
public boolean add(de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node n) - Specified by:
addin interfaceCollection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
addin interfaceList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
clearin interfaceList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
clearin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
addAll
public boolean addAll(Collection<? extends de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node> nodes) - Specified by:
addAllin interfaceCollection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
addAllin interfaceList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
addAllin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
addAll
public boolean addAll(int i, Collection<? extends de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node> nodes) -
containsAll
- Specified by:
containsAllin interfaceCollection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
containsAllin interfaceList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
containsAllin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
retainAll
- Specified by:
retainAllin interfaceCollection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
retainAllin interfaceList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
retainAllin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
removeAll
- Specified by:
removeAllin interfaceCollection<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
removeAllin interfaceList<de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node>- Specified by:
removeAllin interfacede.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node
-
toString
-
getNamedChild
-
setNamedChild
public void setNamedChild(String name, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node node) -
getNamedChildList
-
addToNamedChildList
public void addToNamedChildList(String name, de.fraunhofer.iosb.ilt.frostserver.util.pathparser.Node node)
-