Package VASSAL.build.module
Class Inventory.CounterNode
java.lang.Object
VASSAL.build.module.Inventory.CounterNode
- All Implemented Interfaces:
Comparable<Inventory.CounterNode>
- Enclosing class:
- Inventory
public class Inventory.CounterNode extends Object implements Comparable<Inventory.CounterNode>
CounterNode for the result tree.
- Author:
- spindler
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Inventory.CounterNode.Alpha
Compare two CounterNodes based on the alphanumerical order of their SortKeys.protected class
Inventory.CounterNode.CompareCounterNodes
Base class for comparing two CounterNodes.protected class
Inventory.CounterNode.LengthAlpha
Compare two CounterNodes based on the length of their SortKeys and alphanumerical sorting.protected class
Inventory.CounterNode.Numerical
Compare two CounterNodes based on the first integer value found in their SortKeys. -
Field Summary
Fields Modifier and Type Field Description protected List<Inventory.CounterNode>
children
protected Inventory.Counter
counter
protected String
entry
protected int
level
-
Constructor Summary
Constructors Modifier Constructor Description protected
CounterNode(String entry, Inventory.Counter counter)
CounterNode(String entry, Inventory.Counter counter, int level)
-
Method Summary
Modifier and Type Method Description void
addChild(int i, Inventory.CounterNode counterNode, boolean sort)
void
addChild(Inventory.CounterNode counterNode, boolean sort)
int
compareTo(Inventory.CounterNode node)
Compare this CounterNode to another one based on the respective SortKeys.void
cutLeaves()
void
cutLevel(int cut)
Object
getChild(int index)
int
getChildCount()
Inventory.Counter
getCounter()
String
getEntry()
int
getIndexOfChild(Object child)
int
getLevel()
boolean
isLeaf()
Iterator<Inventory.CounterNode>
iterator()
void
removeChild(Inventory.CounterNode child)
protected String
separator()
Places a separator between elements.void
setLevel(int level)
protected void
sortChildren()
String
toResultString()
protected String
toSortKey()
Sort this CounterNode by the counters key, if no counter use the label.String
toString()
int
updateValues()
-
Field Details
-
entry
-
counter
-
children
-
level
protected int level
-
-
Constructor Details
-
CounterNode
-
CounterNode
-
-
Method Details
-
toString
-
separator
Places a separator between elements. The separator consists of an indent and a linebreak.- Returns:
-
toResultString
-
getEntry
-
getCounter
-
addChild
-
addChild
-
sortChildren
protected void sortChildren() -
removeChild
-
getChildCount
public int getChildCount() -
isLeaf
public boolean isLeaf() -
getChild
-
getIndexOfChild
-
getLevel
public int getLevel() -
setLevel
public void setLevel(int level) -
updateValues
public int updateValues() -
iterator
-
cutLevel
public void cutLevel(int cut) -
cutLeaves
public void cutLeaves() -
compareTo
Compare this CounterNode to another one based on the respective SortKeys.- Specified by:
compareTo
in interfaceComparable<Inventory.CounterNode>
-
toSortKey
Sort this CounterNode by the counters key, if no counter use the label. If no children, use the name of the counterNode, probably could be $PropertyValue$ as well?- Returns:
- key as String
-