Class FormatNode
java.lang.Object
com.github.tadukoo.parsing.fileformat.FormatNode
Represents all the information about how a
Node
should be formatted for a FileFormat
.- Since:
- Alpha v.0.1
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionNames of allowed children of the Nodeprivate final String
The regex used to ensure the data is of the correct formatprivate final int
The required level of the Nodeprivate final String
The name of the Node - used to distinguish in parent/child/sibling requirementsNames of allowed next siblings of the Nodestatic final String
The text used to signify a null (e.g.Names of allowed parents of the NodeNames of allowed previous siblings of the Nodeprivate final String
The regex used to ensure the title is of the correct format -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic FormatNode.FormatNodeBuilder
builder()
Constructs aFormatNode.FormatNodeBuilder
to be used to construct a FormatNode.int
getLevel()
getName()
toString()
Convert this FormatNode into Nodes to be converted into text to be stored and later loaded if needed.
-
Field Details
-
NULL_NODE
The text used to signify a null (e.g. as an allowed Node for parent/child/sibling)- See Also:
-
name
The name of the Node - used to distinguish in parent/child/sibling requirements -
titleRegex
The regex used to ensure the title is of the correct format -
dataRegex
The regex used to ensure the data is of the correct format -
level
private final int levelThe required level of the Node -
parentNames
Names of allowed parents of the Node -
childNames
Names of allowed children of the Node -
prevSiblingNames
Names of allowed previous siblings of the Node -
nextSiblingNames
Names of allowed next siblings of the Node
-
-
Constructor Details
-
FormatNode
private FormatNode(String name, String titleRegex, String dataRegex, int level, List<String> parentNames, List<String> childNames, List<String> prevSiblingNames, List<String> nextSiblingNames) Constructs a FormatNode with the given data.- Parameters:
name
- The name of the NodetitleRegex
- The regex to ensure the title is of the correct formatdataRegex
- The regex to ensure the data is of the correct formatlevel
- The required level of the NodeparentNames
- The names of allowed parent Nodes to this onechildNames
- The names of allowed child Nodes to this oneprevSiblingNames
- The names of allowed previous sibling Nodes to this onenextSiblingNames
- The names of allowed next sibling Nodes to this one
-
-
Method Details
-
builder
Constructs aFormatNode.FormatNodeBuilder
to be used to construct a FormatNode.- Returns:
- A new FormatNodeBuilder
-
getName
- Returns:
- The name for the Node
-
getTitleRegex
- Returns:
- The regex to use in ensuring the title is formatted correctly
-
getDataRegex
- Returns:
- The regex to use in ensuring the data is formatted correctly
-
getNodeRegex
- Returns:
- The title regex and data regex combined, separated by a colon
-
getLevel
public int getLevel()- Returns:
- The required level of the Node
-
getParentNames
- Returns:
- The allowed names for parent Nodes of this one
-
getChildNames
- Returns:
- The allowed names for child Nodes of this one
-
getPrevSiblingNames
- Returns:
- The allowed names for previous sibling Nodes of this one
-
getNextSiblingNames
- Returns:
- The allowed names for next sibling Nodes of this one
-
toString
Convert this FormatNode into Nodes to be converted into text to be stored and later loaded if needed.
-