Class 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 
      Constructor Description
      Vertex​(java.lang.Object referent)
      Creates a vertex tied to a referent object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Vertex v)
      Compares two vertices by keys.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      long key()
      Returns the key for this KeyedObject.
      java.lang.String name()
      Return the name of this vertex.
      java.lang.Object referent()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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: KeyedObject
        Returns the key for this KeyedObject.
        Specified by:
        key in interface KeyedObject
        Returns:
        The key of this vertex.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.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:
        hashCode in class java.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:
        compareTo in interface java.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.