de.javagl.simplemesh.impl
Class DefaultEdge

java.lang.Object
  extended by de.javagl.simplemesh.impl.DefaultEdge
All Implemented Interfaces:
Edge, Indexed, java.io.Serializable

public class DefaultEdge
extends java.lang.Object
implements Edge

Default implementation of an Edge. Note that comparing instances of such edges does neither respect the order of the vertices, nor the index of the edge. So an edge with vertices (A,B) and index M will be considered to be equal to an edge with vertices (B,A) and index N.

See Also:
Serialized Form

Constructor Summary
DefaultEdge(int index, Vertex v0, Vertex v1)
          Creates a new edge with the given index and vertices
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getIndex()
          Returns the index of this object
 Vertex getVertex(int index)
          Returns the specified vertex
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultEdge

public DefaultEdge(int index,
                   Vertex v0,
                   Vertex v1)
Creates a new edge with the given index and vertices

Parameters:
index - The index
v0 - The first vertex
v1 - The second vertex
Method Detail

getIndex

public int getIndex()
Description copied from interface: Indexed
Returns the index of this object

Specified by:
getIndex in interface Indexed
Returns:
The index of this object

getVertex

public Vertex getVertex(int index)
Description copied from interface: Edge
Returns the specified vertex

Specified by:
getVertex in interface Edge
Parameters:
index - The index, 0 or 1
Returns:
The vertex

toString

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

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object