public class Vertex extends ICEObject implements IMeshPart
This class represents a single vertex in a polygon. Multiple Edges can be registered with a single Vertex as listeners, and the Vertex's location can be updated. A Vertex should have its ID set to a unique value before constructing an Edge from it.
iComponentListener
Constructor and Description |
---|
Vertex()
A nullary constructor.
|
Vertex(float[] location)
This constructor takes an array of floats as the location.
|
Vertex(float x,
float y,
float z)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
acceptMeshVisitor(IMeshPartVisitor visitor)
This method calls the
IMeshPartVisitor 's visit method. |
java.lang.Object |
clone()
This operation returns a clone of the Vertex using a deep copy.
|
void |
copy(Vertex vertex)
This operation copies the contents of a Vertex into the current object
using a deep copy.
|
boolean |
equals(java.lang.Object otherObject)
This operation is used to check equality between this Vertex and another
Vertex.
|
float[] |
getLocation()
Gets the current location of the Vertex.
|
int |
hashCode()
This operation returns the hash value of the Vertex.
|
void |
setLocation(float[] location)
Sets the current location of the Vertex.
|
void |
setLocation(float x,
float y,
float z)
Sets the current location of the Vertex.
|
void |
unregister(IUpdateableListener listener)
Overrides the default behavior of unregister.
|
copy, getDescription, getId, getName, register, setDescription, setId, setName, update
public Vertex()
A nullary constructor. This creates a vertex at the origin and initializes any fields necessary for the minimal function of a Vertex. Required for persistence.
public Vertex(float x, float y, float z)
The default constructor. Sets the initial location to the specified coordinates.
x
- The x component of the location.
y
- The y component of the location.
z
- The z component of the location.
public Vertex(float[] location)
This constructor takes an array of floats as the location.
location
- A vector representing the Vertex's location in 3D space.
public void setLocation(float x, float y, float z)
Sets the current location of the Vertex.
x
- The x component of the location.
y
- The y component of the location.
z
- The z component of the location.
public void setLocation(float[] location)
Sets the current location of the Vertex.
location
- A 3D vector of floats representing the Vertex's current location.
public float[] getLocation()
Gets the current location of the Vertex.
A 3D vector of floats representing the Vertex's current location.
public int hashCode()
This operation returns the hash value of the Vertex.
hashCode
in interface Identifiable
hashCode
in class ICEObject
The hash of the Object.
Identifiable.hashCode()
public boolean equals(java.lang.Object otherObject)
This operation is used to check equality between this Vertex and another Vertex. It returns true if the Vertices are equal and false if they are not.
equals
in interface Identifiable
equals
in class ICEObject
otherObject
- The other Object that should be compared with this one.
True if the Objects are equal, false otherwise.
Identifiable.equals(Object otherObject)
public void copy(Vertex vertex)
This operation copies the contents of a Vertex into the current object using a deep copy. Listeners are not copied.
vertex
- The Object from which the values should be copied.
public java.lang.Object clone()
This operation returns a clone of the Vertex using a deep copy. Listeners are not copied.
clone
in interface Identifiable
clone
in class ICEObject
The new clone.
public void unregister(IUpdateableListener listener)
unregister
in interface IUpdateable
unregister
in class ICEObject
listener
- The listener that should no longer receive updates.
IUpdateable.unregister(IUpdateableListener listener)
public void acceptMeshVisitor(IMeshPartVisitor visitor)
This method calls the IMeshPartVisitor
's visit method.
acceptMeshVisitor
in interface IMeshPart
visitor
-
The IMeshPartVisitor
that is visiting this
IMeshPart
.