Package io.jenetics.ext.rewriting
Class TreePattern.Var<V>
- java.lang.Object
-
- io.jenetics.ext.rewriting.TreePattern.Decl<V>
-
- io.jenetics.ext.rewriting.TreePattern.Var<V>
-
- Type Parameters:
V
- the node type the tree-pattern is working
- All Implemented Interfaces:
Serializable
,Comparable<TreePattern.Var<V>>
- Enclosing class:
- TreePattern<V>
public static final class TreePattern.Var<V> extends TreePattern.Decl<V> implements Comparable<TreePattern.Var<V>>, Serializable
Represents a placeholder (variable) for an arbitrary sub-tree. A pattern variable is identified by its name. The pattern DSL denotes variable names with a leading '$' character, e.g.$x
,$y
or$my_var
. It is one of two implementations of the sealedTreePattern.Decl
class.- See Also:
TreePattern.Val
, Serialized Form- Implementation Note:
- This class is comparable by it's name.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(TreePattern.Var<V> var)
boolean
equals(Object obj)
int
hashCode()
String
name()
Return the name of the variable.static <V> TreePattern.Var<V>
of(String name)
Return a new variable with the given name.String
toString()
-
-
-
Method Detail
-
compareTo
public int compareTo(TreePattern.Var<V> var)
- Specified by:
compareTo
in interfaceComparable<V>
-
of
public static <V> TreePattern.Var<V> of(String name)
Return a new variable with the given name.- Type Parameters:
V
- the node type the tree-pattern is working on- Parameters:
name
- the name of the variable- Returns:
- a new variable with the given name
- Throws:
NullPointerException
- if the givenname
isnull
IllegalArgumentException
- if the givenname
is not a valid Java identifier
-
-