Class KeyTree.Node
java.lang.Object
org.simpleyaml.configuration.comments.KeyTree.Node
- All Implemented Interfaces:
Iterable<KeyTree.Node>
- Enclosing class:
- KeyTree
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<KeyTree.Node>protected Stringprotected Integerprotected intprotected Map<Integer,KeyTree.Node> protected Map<String,KeyTree.Node> protected booleanprotected Integerprotected Stringprotected final KeyTree.Nodeprotected Map<String,KeyTree.Node> protected String -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyTree.Nodeprotected KeyTree.Nodeprotected voidchildren()voidclear()booleanclearIf(Predicate<KeyTree.Node> condition) protected booleanclearIf(Predicate<KeyTree.Node> condition, boolean removeFromParent) protected voidentries()get(int i) Get a child from its index.Get a child from its path.protected KeyTree.NodeGet a child from its path, or optionally add a new one if it is not created.getElement(int i) Get a child list element from its index.protected KeyTree.NodegetElement(int i, boolean add) Get a child list element from its index, or optionally add a new one if it is not created.getFirst()intgetLast()getName()getPath()getPriority(String path) Get a child from its path.getValue()booleanbooleanbooleanisList()voidisList(int listSize) booleaniterator()keys()voidsetComment(String comment) voidsetElementIndex(int elementIndex) protected voidsetPriority(String key, KeyTree.Node child) voidsetSideComment(String sideComment) intsize()toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
parent
-
name
-
indent
protected int indent -
children
-
indexByName
-
priorityIndex
-
indexByElementIndex
-
comment
-
sideComment
-
isList
protected boolean isList -
listSize
-
elementIndex
-
-
Method Details
-
getName
-
getComment
-
setComment
-
getSideComment
-
setSideComment
-
getParent
-
isRootNode
public boolean isRootNode() -
isFirstNode
public boolean isFirstNode() -
getIndentation
public int getIndentation() -
get
Get a child from its path, or optionally add a new one if it is not created.- Parameters:
path- the path of children names to look for separated byKeyTree.options()ConfigurationOptions.pathSeparator()add- if a new node must be added if it does not existpriority- if true the priority index is used to allow specific repetitions on list values (manually added), otherwise all nodes are allowed (loaded)- Returns:
- the child that has the provided path or null if not found and not added
-
get
Get a child from its path. May contain repetitions with list elements when using names (values can be repeated on a list).- Parameters:
path- the path of names to look for separated byKeyTree.options()ConfigurationOptions.pathSeparator()- Returns:
- the child that has the provided path or null if not found
-
getPriority
Get a child from its path. Repetitions on list values are only allowed to keys inserted with priority usingadd(String).- Parameters:
path- the path of names to look for separated byKeyTree.options()ConfigurationOptions.pathSeparator()- Returns:
- the child that has the provided path or null if not found
-
getElement
Get a child list element from its index, or optionally add a new one if it is not created.
Ifiis negative then gets the child at indexsize()+ i
Example:node.get(-1)gets the last child ofnode- Parameters:
i- the index of the childadd- if a new node must be added if it does not exist- Returns:
- the child with index i or null if not found and not created
-
getElement
Get a child list element from its index.
Ifiis negative then gets the child element indexed bysize()+ i
Example:node.get(-1)gets the last child element of thenodelist.- Parameters:
i- the index of the child element- Returns:
- the child with index i or null if not found
-
get
Get a child from its index.
Ifiis negative then gets the child at indexsize()+ i
Example:node.get(-1)gets the last child ofnode- Parameters:
i- the index of the child- Returns:
- the child with index i or null if not found
-
getFirst
-
getLast
-
add
-
add
-
add
-
add
-
setPriority
-
checkList
protected void checkList() -
getValue
-
hasChildren
public boolean hasChildren() -
children
-
keys
-
entries
-
size
public int size() -
isList
public boolean isList() -
isList
public void isList(int listSize) -
getListSize
-
setElementIndex
public void setElementIndex(int elementIndex) -
getElementIndex
-
getPath
-
getPathWithName
-
clearNode
protected void clearNode() -
clearIf
-
clearIf
-
clear
public void clear() -
iterator
- Specified by:
iteratorin interfaceIterable<KeyTree.Node>
-
toString
-