Class VertexMergerGroup

  • All Implemented Interfaces:
    ISamplePoint

    public class VertexMergerGroup
    extends Vertex
    A synthetic vertex used to handle cases when multiple vertices occupy coincident locations.
    • Constructor Detail

      • VertexMergerGroup

        public VertexMergerGroup​(Vertex firstVertex)
        Constructs a coincident vertex using the specified vertex for initialization.
        Parameters:
        firstVertex - a valid instance
    • Method Detail

      • addVertex

        public boolean addVertex​(Vertex v)
        Add a new vertex to the coincident collection. Recompute z value using current rule.
        Parameters:
        v - a valid, unique instance
        Returns:
        true if added to collection; otherwise false
      • removeVertex

        public boolean removeVertex​(Vertex v)
        Removes the specified vertex from the group. If the vertex is not currently a member of the group, this operation will be ignored.
        Parameters:
        v - the vertex to be removed.
        Returns:
        true if the vertex was a member of the group and was removed; otherwise, false.
      • setResolutionRule

        public void setResolutionRule​(VertexMergerGroup.ResolutionRule rule)
        Sets the rule for resolving coincident vertices; recalculates value for vertex if necessary
        Parameters:
        rule - a valid member of the enumeration
      • getZ

        public double getZ()
        Get the z value associated with the vertex and the merging rules. If the vertex is null, the return value for this method is Double.NaN ("not a number").
        Specified by:
        getZ in interface ISamplePoint
        Overrides:
        getZ in class Vertex
        Returns:
        a floating point value or Double.NaN if z value is null.
      • getVertices

        public Vertex[] getVertices()
        Gets an array of the coincident vertices. Each invocation of this method results in a new instance of the array.
        Returns:
        a valid array of size 1 or greater.
      • getSize

        public int getSize()
        Gets the number of vertices grouped together in the collection
        Returns:
        normally, a value of 1 or greater; but if the last vertex in the group has been removed, a value of zero.
      • contains

        public boolean contains​(Vertex v)
        Indicates whether the group contains the specified vertex
        Parameters:
        v - a valid vertex
        Returns:
        true if the vertex is a member of the group; otherwise, false.
      • setAuxiliaryIndex

        public void setAuxiliaryIndex​(int auxiliaryIndex)
        Sets the color index for the vertex. The color index field is provided in support of graph-coloring algorithms. Values in the range 0 to 255 are supported.

        This method will set the color index for all vertices contain within the merger group.

        Overrides:
        setAuxiliaryIndex in class Vertex
        Parameters:
        auxiliaryIndex - a value in the range 0 to 255