Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Node class for holding the value and position of an element.
- * @author Charlie Davis (CLD0023@auburn.edu)
- * @version 2011-04-04
- */
- public class Node {
- private int position;
- private int value;
- /**
- *Empty constructor.
- */
- public Node() {
- }
- /**
- *Takes in a Node and basically copies the value and position.
- *@param n Node to copy values from.
- */
- public Node(Node n)
- {
- setValue(n.getValue());
- setPosition(n.getPosition());
- }
- /**
- *Constructor that takes in value and position int's and sets them.
- *@param value to be set.
- *@param position to be set.
- */
- public Node(int v, int p) {
- this.setValue(v);
- this.setPosition(p);
- }
- /**
- *Returns the value this Node contains.
- *@return value the node contains.
- */
- public int getValue() {
- return value;
- }
- /**
- *Returns the position of this Node.
- *@return int position this Node holds.
- */
- public int getPosition() {
- return position;
- }
- /**
- *Sets the value of this node to the parameter
- *@param v value to be set.
- */
- public void setValue(int v) {
- this.value = value;
- }
- /**
- *Sets the position of this node to the parameter.
- *@param p position to be set.
- */
- public void setPosition(int p) {
- this.position = position;
- }
- }
Add Comment
Please, Sign In to add comment