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,$yor$my_var. It is one of two implementations of the sealedTreePattern.Declclass.- 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 intcompareTo(TreePattern.Var<V> var)booleanequals(Object obj)inthashCode()Stringname()Return the name of the variable.static <V> TreePattern.Var<V>of(String name)Return a new variable with the given name.StringtoString()
-
-
-
Method Detail
-
compareTo
public int compareTo(TreePattern.Var<V> var)
- Specified by:
compareToin 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 givennameisnullIllegalArgumentException- if the givennameis not a valid Java identifier
-
-