java.lang.Object
org.unifi.mecvirtualresourceallocation.graph.Edge

public class Edge extends Object
Represents an edge in a conflict graph. Each edge connects two vertices.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Edge(Vertex vertex1, Vertex vertex2)
    Constructs an edge connecting the specified vertices.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if this edge is equal to another object.
    Gets the first vertex connected by the edge.
    Gets the second vertex connected by the edge.
    int
    Returns a hash code value for the edge.
    Returns a string representation of the edge, including the IDs of the connected vertices.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Edge

      public Edge(Vertex vertex1, Vertex vertex2)
      Constructs an edge connecting the specified vertices. Ensures that the vertices are stored in a consistent order based on their IDs.
      Parameters:
      vertex1 - the first vertex connected by the edge
      vertex2 - the second vertex connected by the edge
  • Method Details

    • getVertex1

      public Vertex getVertex1()
      Gets the first vertex connected by the edge.
      Returns:
      the first vertex
    • getVertex2

      public Vertex getVertex2()
      Gets the second vertex connected by the edge.
      Returns:
      the second vertex
    • equals

      public boolean equals(Object o)
      Checks if this edge is equal to another object. Two edges are considered equal if they connect the same pair of vertices.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare with
      Returns:
      true if the edges are equal, false otherwise
    • hashCode

      public int hashCode()
      Returns a hash code value for the edge. The hash code is computed based on the vertices connected by the edge.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for the edge
    • toString

      public String toString()
      Returns a string representation of the edge, including the IDs of the connected vertices.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the edge