dataStructure\Node - HilaShoshan/RobotsGame GitHub Wiki

This class implements node_data interface, and representing a Node: * Node is a vertex, in a graph for example, and has key (ID: unique to every node). * there are some more attributes to the node, that will help us to implement the algorithms in the rest of our project.

Methods...

Constructors:

  1. public Node() - Default

  2. public Node(int key, Point3D location)

  3. public Node(int key)

    • choose a random location for the node.
  4. public Node(Node copy)

    • Deep copy to the node.

Functions:

  1. public int compareTo(Object obj)

    (implements compareTo method in Comparable interface).

    • This method compare between two objects (it will be nodes).
    • The two objects are: this Node & another one we get like object.
    • It used for the priorityQueue in shortestPath method (Graph_Algo class).
    • The comparison is made by weight parameter of the Nodes (bigger weight --> bigger Node).
    • @return: 1 - if this Node is bigger, 0 - if the given Node is bigger