Package ghidra.util.graph
Class Vertex
- java.lang.Object
-
- ghidra.util.graph.Vertex
-
- All Implemented Interfaces:
KeyedObject,java.lang.Comparable<Vertex>
public class Vertex extends java.lang.Object implements KeyedObject, java.lang.Comparable<Vertex>
An implementation of vertices for use in ghidra.util.graph.
-
-
Constructor Summary
Constructors Change Constructor Description Vertex(java.lang.Object referent)Creates a vertex tied to a referent object.
-
Method Summary
All Methods Instance Methods Concrete Methods Change Modifier and Type Method Description intcompareTo(Vertex v)Compares two vertices by keys.booleanequals(java.lang.Object o)inthashCode()longkey()Returns the key for this KeyedObject.java.lang.Stringname()Return the name of this vertex.java.lang.Objectreferent()java.lang.StringtoString()
-
-
-
Constructor Detail
-
Vertex
public Vertex(java.lang.Object referent)
Creates a vertex tied to a referent object. The object the key refers to can be obtained from the vertex factory using the key of the vertex. If there is already a vertex having the same key as returned by KeyedObjectFactory.getInstance().getKeyForThisObject( Object o ), then a DuplicateKeyException is thrown and no vertex is created.
-
-
Method Detail
-
key
public long key()
Description copied from interface:KeyedObjectReturns the key for this KeyedObject.- Specified by:
keyin interfaceKeyedObject- Returns:
- The key of this vertex.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object- Returns:
- true iff and only if the given object is a Vertex with the same key.
-
referent
public java.lang.Object referent()
- Returns:
- The Object this vertex refers to specified at creation time.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Overides hashCode() to use the key of this Vertex.
-
compareTo
public int compareTo(Vertex v)
Compares two vertices by keys. If the specified object o is not a Vertex a ClassCastException will be thrown.- Specified by:
compareToin interfacejava.lang.Comparable<Vertex>
-
name
public java.lang.String name()
Return the name of this vertex. If the Vertex has a referent, the referent's toString() method will be used to create the name. If the Vertex has a null referent, then the key will be used to determine the name.
-
-