Results 1 to 2 of 2
Thread: Queuing Nodes
- 01-04-2012, 10:33 PM #1
Member
- Join Date
- Jan 2012
- Posts
- 1
- Rep Power
- 0
Queuing Nodes
I am trying to make a basic program for an Air traffic controller to land planes as the come in using nodes but i cant get the nodes to order properly as when i add a new one in it deletes the first node.
here is my code for the ordering of the nodes.
The add planeIn PlaneNode works fine. Any help would be great. ThanksJava Code:public void addPlane (PlaneNode planeIn) { if (start == null) { start = planeIn; end = planeIn; planeIn.setNext(null); planeIn.setPrevious(null); end = start; System.out.println("Thank you the plane has been added"); System.out.println(planeIn.toString()); } else { // if(end == start ){ // // get the lastNode in queue // PlaneNode currentFirst = new PlaneNode (); // currentFirst = this.getEnd(); // currentFirst.setNext(planeIn); // planeIn.setPrevious(currentFirst); // planeIn.setNext(null); // end = planeIn; // System.out.println(currentFirst.toString()); // System.out.println(planeIn.toString()); // System.out.println("Thank you the plane has been added1"); // } else { // // if already nodes in queue // get the lastNode in queue PlaneNode currentLast = this.getEnd(); // current update currentLast.setNext(planeIn); // new plane update planeIn.setPrevious(currentLast); planeIn.setNext(null); // update queue's last value to point to new plane this.end = planeIn; System.out.println("Thank you the plane has been added2"); } }
MattLast edited by Norm; 01-04-2012 at 11:02 PM. Reason: added code tags
- 01-04-2012, 11:03 PM #2
Similar Threads
-
Inserting Nodes
By myst in forum New To JavaReplies: 2Last Post: 07-12-2010, 04:26 PM -
Problem with Nodes - need help!
By Smithy in forum New To JavaReplies: 3Last Post: 03-20-2010, 03:47 PM -
nodes
By Dr Gonzo in forum New To JavaReplies: 1Last Post: 12-08-2008, 04:22 PM -
nodes in java
By ahsan in forum New To JavaReplies: 0Last Post: 12-26-2007, 03:09 PM -
Queuing Bulk Web request For Later Execution
By kathiravan in forum Web FrameworksReplies: 0Last Post: 10-31-2007, 11:19 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks