public class Label
extends java.lang.Object
A label has a name and an arity. The name represents the text of the label, while the arity is the number of nodes that must be incident to the label. When the arity of a label is -1, this means that an edge labeled with the label may be incident with any number of nodes.
As far as the graph library is concerned, instances of this class are
immutable. It is possible to create a subclass of this class, for example
to override the toString()
method or to attach
additional information to a label, but subclasses cannot interfere with the
internal state known to this class: all methods except toString()
are final.
Constructor and Description |
---|
Label(Label orig)
Creates a new Label which is a copy of another one.
|
Label(java.lang.String name)
Create a new binary label.
|
Label(java.lang.String name,
int arity)
Creates a new label with a given name and arity.
|
public Label(java.lang.String name, int arity)
name
- the name of the new labelarity
- the arity of the new labeljava.lang.NullPointerException
- if name
is null
java.lang.IllegalArgumentException
- if arity
is smaller that 0public Label(java.lang.String name)
name
- the name of the new labeljava.lang.NullPointerException
- if name
is null
java.lang.IllegalArgumentException
- if arity
is smaller that 0public Label(Label orig)
orig
- the label that the new label is a copy ofpublic final java.lang.String getName()
public final int getArity()
public java.lang.String toString()
toString
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object