AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.graph.GraphNode Class Reference
Inheritance diagram for game2dai.graph.GraphNode:

Public Member Functions

 GraphNode (int id)
 
 GraphNode (int id, double x, double y, double z)
 
 GraphNode (int id, double x, double y)
 
 GraphNode (GraphNode node)
 
int id ()
 
void id (int id)
 
double x ()
 
float xf ()
 
void x (double x)
 
double y ()
 
float yf ()
 
void y (double y)
 
double z ()
 
float zf ()
 
void z (double z)
 
int compareTo (Object o)
 
String toString ()
 

Protected Attributes

int id
 

Package Attributes

double x
 
double y
 
double z
 

Detailed Description

This class represents a node (vertex) that can be used with the Graph class.

The node has a position in 3D space for 2D applications the z value should be zero.

Each node should be given a unique ID number >= 0. Node ID numbers do not need to start at 0 (zero) or be sequential but they must be unique.

It is the responsibility of the user to ensure that each node ID is unique as duplicate ID numbers can lead to unpredictable behaviour.

Author
Peter Lager

Constructor & Destructor Documentation

◆ GraphNode() [1/4]

game2dai.graph.GraphNode.GraphNode ( int  id)

Create a node with a given ID

Parameters
id

◆ GraphNode() [2/4]

game2dai.graph.GraphNode.GraphNode ( int  id,
double  x,
double  y,
double  z 
)

Create a node

Parameters
idunique id number for this node
x
y
zset to 0 (zero for 2D applications

◆ GraphNode() [3/4]

game2dai.graph.GraphNode.GraphNode ( int  id,
double  x,
double  y 
)

Create a node

Parameters
idunique id number for this node
x
y

◆ GraphNode() [4/4]

game2dai.graph.GraphNode.GraphNode ( GraphNode  node)

Copy constructor.

Parameters
nodenode to copy from

Member Function Documentation

◆ compareTo()

int game2dai.graph.GraphNode.compareTo ( Object  o)

Compare nodes based on ID number.

◆ id() [1/2]

int game2dai.graph.GraphNode.id ( )

Get the node ID

Returns
the id

◆ id() [2/2]

void game2dai.graph.GraphNode.id ( int  id)

Change the node id.
Care should be taken to ensure the new ID number is unique

Parameters
idthe id to set

◆ x() [1/2]

double game2dai.graph.GraphNode.x ( )
Returns
the x position

◆ x() [2/2]

void game2dai.graph.GraphNode.x ( double  x)
Parameters
xthe new x position

◆ xf()

float game2dai.graph.GraphNode.xf ( )
Returns
the x position as a float

◆ y() [1/2]

double game2dai.graph.GraphNode.y ( )
Returns
the y position

◆ y() [2/2]

void game2dai.graph.GraphNode.y ( double  y)
Parameters
ythe new y position

◆ yf()

float game2dai.graph.GraphNode.yf ( )
Returns
the y position as a float

◆ z() [1/2]

double game2dai.graph.GraphNode.z ( )
Returns
the z position

◆ z() [2/2]

void game2dai.graph.GraphNode.z ( double  z)
Parameters
zthe new z position

◆ zf()

float game2dai.graph.GraphNode.zf ( )
Returns
the y position as a float

The documentation for this class was generated from the following file: