ch.ethz.graphbench.toolbox
Class Vertex

java.lang.Object
  |
  +--ch.ethz.graphbench.toolbox.Vertex

public class Vertex
extends java.lang.Object

Class representing a vertex in 2D eucledian space.
A new vertex cannot be instanciated directly, use the method createVertex() from the class Graph instead.


Field Summary
static int ACTIVE_STATE
          Specifies that the vertex is currently active
static java.awt.Color DEFAULT_VERTEX_COLOR
          Default color of a vertex
static int INVALID_STATE
          Specifies that the vertex is invalid
static int PROCESSED_STATE
          Specifies that the vertex has been processed
static int QUEUED_STATE
          Specifies that the vertex is currently queued
static int VALID_STATE
          Specifies that the vertex is valid
static int VOID_STATE
          Specifies that the edge is currently active
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks if the passed object is equal to the vertex object.
 java.awt.Color getColor()
          Gets the color of the vertex
 int getDegree()
          Gets the degree of the vertex
 java.util.Iterator getEdgeIterator()
          Returns an iterator over all edges adjacent to the vertex.
 int getIndex()
          Gets the index of the vertex
 java.lang.String getName()
          Gets the name of the vertex
 java.awt.Point getPosition()
          Gets the position of the vertex
 java.lang.Object getUserData(java.lang.Object key)
          Returns the value to which the specified key is mapped.
 int getVertexState()
          Gets the state of the vertex
 void putUserData(java.lang.Object key, java.lang.Object value)
          Maps the specified key to the specified value.
 void resetVertexState()
          Resets the state of the vertex.
 void setColor(java.awt.Color color)
          Sets the color of the vertex
 void setName(java.lang.String name)
          Sets the name attribute of the vertex
 void setPosition(java.awt.Point position)
          Sets the position of the vertex
 void setVertexState(int state)
          Sets the state of the vertex.
Valid states are: QUEUED_STATE, ACTIVE_STATE and PROCESSED_STATE.
A vertex can only be in one state at any given time.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VERTEX_COLOR

public static final java.awt.Color DEFAULT_VERTEX_COLOR
Default color of a vertex

ACTIVE_STATE

public static final int ACTIVE_STATE
Specifies that the vertex is currently active

QUEUED_STATE

public static final int QUEUED_STATE
Specifies that the vertex is currently queued

PROCESSED_STATE

public static final int PROCESSED_STATE
Specifies that the vertex has been processed

VOID_STATE

public static final int VOID_STATE
Specifies that the edge is currently active

VALID_STATE

public static final int VALID_STATE
Specifies that the vertex is valid

INVALID_STATE

public static final int INVALID_STATE
Specifies that the vertex is invalid
Method Detail

setName

public void setName(java.lang.String name)
Sets the name attribute of the vertex
Parameters:
name - The new name

setColor

public void setColor(java.awt.Color color)
Sets the color of the vertex
Parameters:
color - The new color

setPosition

public void setPosition(java.awt.Point position)
Sets the position of the vertex
Parameters:
position - The new position

setVertexState

public void setVertexState(int state)
Sets the state of the vertex.
Valid states are: QUEUED_STATE, ACTIVE_STATE and PROCESSED_STATE.
A vertex can only be in one state at any given time.
Parameters:
state - The new state of the vertex

resetVertexState

public void resetVertexState()
Resets the state of the vertex.

getIndex

public int getIndex()
Gets the index of the vertex
Returns:
The index

getName

public java.lang.String getName()
Gets the name of the vertex
Returns:
The name

getUserData

public java.lang.Object getUserData(java.lang.Object key)
Returns the value to which the specified key is mapped.
Parameters:
key - key identifying value to be returned
Returns:
the value to which the key is mapped; null if the key is not mapped to any value

getColor

public java.awt.Color getColor()
Gets the color of the vertex
Returns:
The color value

getDegree

public int getDegree()
Gets the degree of the vertex
Returns:
The degree

getEdgeIterator

public java.util.Iterator getEdgeIterator()
Returns an iterator over all edges adjacent to the vertex.
Returns:
Iterator over all edges

getVertexState

public int getVertexState()
Gets the state of the vertex
Returns:
The state of the vertex (QUEUED_STATE, ACTIVE_STATE or PROCESSED_STATE) or -1 if state has not been set.

getPosition

public java.awt.Point getPosition()
Gets the position of the vertex
Returns:
The position

putUserData

public void putUserData(java.lang.Object key,
                        java.lang.Object value)
Maps the specified key to the specified value. Neither the key nor the value can be null.
The value can be retrieved by calling the get method with a key that is equal to the original key.
Parameters:
key - the key
value - the value

equals

public boolean equals(java.lang.Object obj)
Checks if the passed object is equal to the vertex object.
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to be compared
Returns:
true if object is equal, false otherwise