public class MetricalLpcfgNonterminal extends java.lang.Object implements MetricalLpcfgNode, java.io.Serializable
MetricalLpcfgNonterminal
is an internal node in a metrical lpcfg tree.Modifier and Type | Class and Description |
---|---|
static class |
MetricalLpcfgNonterminal.MetricalLpcfgLevel
An enum representing the level of a
MetricalLpcfgNonterminal |
static class |
MetricalLpcfgNonterminal.MetricalLpcfgType
An enum representing the type of a
MetricalLpcfgNonterminal |
Modifier and Type | Field and Description |
---|---|
private java.util.List<MetricalLpcfgNode> |
children
A List of the children of this node.
|
private MetricalLpcfgNonterminal.MetricalLpcfgLevel |
level
The level of this node.
|
private static long |
serialVersionUID
Version 1
|
private MetricalLpcfgNonterminal.MetricalLpcfgType |
type
The type of this node.
|
Constructor and Description |
---|
MetricalLpcfgNonterminal(MetricalLpcfgNonterminal.MetricalLpcfgLevel level)
Create a new non-terminal, initially of
type MetricalLpcfgNonterminal.MetricalLpcfgType.EVEN . |
MetricalLpcfgNonterminal(MetricalLpcfgNonterminal nonterminal)
Create a new non-terminal as a deep copy of the given one.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(MetricalLpcfgNode child)
Add a new node as a child of this non-terminal.
|
MetricalLpcfgNonterminal |
deepCopy()
Get a deep copy of this node.
|
boolean |
equals(java.lang.Object o) |
void |
fixChildrenTypes()
|
java.util.List<MetricalLpcfgNode> |
getChildren()
Get the children of this non-terminal.
|
MetricalLpcfgHead |
getHead()
Get the head of this non-terminal.
|
int |
getLength()
Get the length of this node, measured in sub beats.
|
MetricalLpcfgNonterminal.MetricalLpcfgLevel |
getLevel()
Get the level of this non-terminal.
|
MetricalLpcfgTerminal |
getTerminal()
Get the terminal at this level of the tree.
|
java.lang.String |
getTransitionString()
Get the transition String of this non-terminal.
|
java.lang.String |
getTypeString()
Get the String of the type of this node.
|
boolean |
isEmpty()
Get if this node is empty or not.
|
void |
setType(MetricalLpcfgNonterminal.MetricalLpcfgType type)
Set the
type to the given value. |
boolean |
startsWithRest()
Get if this node starts with a REST or not.
|
java.lang.String |
toString() |
java.lang.String |
toStringPretty(int depth,
java.lang.String tab)
Print the given node recursively in a pretty format.
|
private static final long serialVersionUID
private MetricalLpcfgNonterminal.MetricalLpcfgType type
private final MetricalLpcfgNonterminal.MetricalLpcfgLevel level
private final java.util.List<MetricalLpcfgNode> children
public MetricalLpcfgNonterminal(MetricalLpcfgNonterminal.MetricalLpcfgLevel level)
type
MetricalLpcfgNonterminal.MetricalLpcfgType.EVEN
.level
- level
public MetricalLpcfgNonterminal(MetricalLpcfgNonterminal nonterminal)
nonterminal
- The non-terminal we want a deep copy of.public boolean isEmpty()
MetricalLpcfgNode
isEmpty
in interface MetricalLpcfgNode
public boolean startsWithRest()
MetricalLpcfgNode
startsWithRest
in interface MetricalLpcfgNode
public java.util.List<MetricalLpcfgNode> getChildren()
children
public void addChild(MetricalLpcfgNode child)
child
- The new child node to add to children
public void setType(MetricalLpcfgNonterminal.MetricalLpcfgType type)
type
to the given value.type
- type
public java.lang.String getTypeString()
type
's toString.public MetricalLpcfgNonterminal.MetricalLpcfgLevel getLevel()
level
public MetricalLpcfgTerminal getTerminal()
MetricalLpcfgNode
getTerminal
in interface MetricalLpcfgNode
public java.lang.String getTransitionString()
public MetricalLpcfgHead getHead()
getHead
in interface MetricalLpcfgNode
public void fixChildrenTypes()
public int getLength()
MetricalLpcfgNode
getLength
in interface MetricalLpcfgNode
public MetricalLpcfgNonterminal deepCopy()
MetricalLpcfgNode
deepCopy
in interface MetricalLpcfgNode
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toStringPretty(int depth, java.lang.String tab)
MetricalLpcfgNode
toStringPretty
in interface MetricalLpcfgNode
depth
- The depth of this node.tab
- The tab String to indent tree levels.public java.lang.String toString()
toString
in class java.lang.Object