de.javagl.simplemesh.impl
Class DefaultVertex

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

public class DefaultVertex
extends java.lang.Object
implements Vertex

Default implementation of a Vertex. Comparing two instances of this class for equality will ONLY compare the indices and ignore the coordinates of the vertices.

See Also:
Serialized Form

Constructor Summary
DefaultVertex(int index)
          Creates a new vertex (at 0,0,0) with the given index
DefaultVertex(int index, float x, float y, float z)
          Creates a new vertex with the given index and position.
DefaultVertex(int index, Vertex other)
          Creates a new vertex with the given index, at the same position as the given vertex.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getIndex()
          Returns the index of this object
 float getX()
          Returns the x-coordinate of this vertex
 float getY()
          Returns the y-coordinate of this vertex
 float getZ()
          Returns the z-coordinate of this vertex
 int hashCode()
           
 void setX(float x)
          Set the x-coordinate of this vertex
 void setY(float y)
          Set the y-coordinate of this vertex
 void setZ(float z)
          Set the z-coordinate of this vertex
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultVertex

public DefaultVertex(int index)
Creates a new vertex (at 0,0,0) with the given index

Parameters:
index - The index of the vertex

DefaultVertex

public DefaultVertex(int index,
                     Vertex other)
Creates a new vertex with the given index, at the same position as the given vertex.

Parameters:
index - The index
other - The other vertex

DefaultVertex

public DefaultVertex(int index,
                     float x,
                     float y,
                     float z)
Creates a new vertex with the given index and position.

Parameters:
index - The index
x - The x-coordinate
y - The y-coordinate
z - The z-coordinate
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

setX

public void setX(float x)
Description copied from interface: Vertex
Set the x-coordinate of this vertex

Specified by:
setX in interface Vertex
Parameters:
x - The x-coordinate of this vertex

setY

public void setY(float y)
Description copied from interface: Vertex
Set the y-coordinate of this vertex

Specified by:
setY in interface Vertex
Parameters:
y - The y-coordinate of this vertex

setZ

public void setZ(float z)
Description copied from interface: Vertex
Set the z-coordinate of this vertex

Specified by:
setZ in interface Vertex
Parameters:
z - The z-coordinate of this vertex

getX

public float getX()
Description copied from interface: Vertex
Returns the x-coordinate of this vertex

Specified by:
getX in interface Vertex
Returns:
The x-coordinate of this vertex

getY

public float getY()
Description copied from interface: Vertex
Returns the y-coordinate of this vertex

Specified by:
getY in interface Vertex
Returns:
The y-coordinate of this vertex

getZ

public float getZ()
Description copied from interface: Vertex
Returns the z-coordinate of this vertex

Specified by:
getZ in interface Vertex
Returns:
The z-coordinate of this 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