public class GraphNode
extends java.lang.Object
implements java.lang.Comparable<java.lang.Object>
Constructor and Description |
---|
GraphNode(GraphNode node)
Copy constructor.
|
GraphNode(int id)
Create a node with a given ID
|
GraphNode(int id,
double x,
double y)
Create a node
|
GraphNode(int id,
double x,
double y,
double z)
Create a node
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object o)
Compare nodes based on ID number.
|
int |
id()
Get the node ID
|
void |
id(int id)
Change the node id.
|
java.lang.String |
toString() |
double |
x() |
void |
x(double x) |
float |
xf() |
double |
y() |
void |
y(double y) |
float |
yf() |
double |
z() |
void |
z(double z) |
float |
zf() |
public GraphNode(int id)
id
- public GraphNode(int id, double x, double y, double z)
id
- unique id number for this nodex
- y
- z
- set to 0 (zero for 2D applicationspublic GraphNode(int id, double x, double y)
id
- unique id number for this nodex
- y
- public GraphNode(GraphNode node)
node
- node to copy frompublic int id()
public void id(int id)
id
- the id to setpublic double x()
public float xf()
public void x(double x)
x
- the new x positionpublic double y()
public float yf()
public void y(double y)
y
- the new y positionpublic double z()
public float zf()
public void z(double z)
z
- the new z positionpublic int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable<java.lang.Object>
public java.lang.String toString()
toString
in class java.lang.Object
Processing library AI_for_2D_Games by Peter Lager. (C) 2013