Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please, I need help In ordered doubly linked list in java with JUnit test. From page 4 to 9 are my doubly linked list and

Please, I need help In ordered doubly linked list in java with JUnit test. From page 4 to 9 are my doubly linked list and it passes the JUnit test. I need for ordered doubly Linked List class.
Thank you,
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Eclipse IDE Search Project Run Window Help package edu.mccc.cos210.ds; 3 public interface IOrderedList extends IDoublylinkedList, java.lang.IterableT 5 public boolean contains(T data); 4 public void add (T data) 6 t this time 0 errors, 2 warnings, 2 others Description > warnings (2 terms) Infos (2 items) Writable Smart Insert 1:1 ccc/cos210/ds/OrderedList.java-Eclipse IDE rch Project Run Window Help OrderedList,java 3 B DataStructures2019 (B impledu.mccc.cos210.d:) e orderedListeT 1 package edu.mccc.cos210.ds; 2 public class OrderedList extends DoublyLinkedLstCT> mplements lorderedListeT>R 4 override 5 public void add(T data) f addFirst (data); addLast (data); 7 9 10 11 12 13 @Override public boolean contains(T data) t boolean head false; java , util . Iterator while (it.hasNext () t iterator(); if(it.next() equals (data)) f 15 016 17 18 return true; return false; 20 return head; 23 l I 24 25 26 @ Console 3 sterminated ijm,OrderedListTests DUnit] CAUsersieltraore88Desktop jdk-11.0.2binljevaw.exe (Feb 0 errors, 2 wa Description FAILURE: makeTypeChar Success: addingAddsLast Warni ntul istContains duta 100 11 @Override public boolean contains (T data) f Console terminateds jim OrderedListTests [JUnit] CAUserslaltraore81Desktoplj Testing: OrderedList FAILURE: makeTypeDouble FAILURE: makeTypeString Success: addingDoesNotContain Success: addingContains_singleEntry Success: integrity_compareToClon ut FAILURE: integrity-compareToSB Success: addingContains_ manyEntries FAILURE makeTypeInt Success makeTypeBoolean FAILURE makeTypeChar Success: addingAddsLast Success: emptyListContains ts.r ||DOrderedlistjava "DoublyLinkedListjava 23 a DataStructures2019 (B impledu.rnccc.cos210.ds > DoublylinkedlistT> > 1 package edu.mccc.cos210.ds; 2 public class DoublylinkedList implements IDoublyLinkedList terat or() 83 { 84 85 86 Override return new ForwardIterator(); 87 public java.util.Iterator reverseIterator) t return new Reverselterator); 89 9 private class ForwardIterator implements java.util.Iterator f 91 92 private DNode node null; private DNode nextNode - head; eoverride 94 public boolean hasNext() f if (nextNode null) ( return false; return true; console X terminateds jim.OrderedList ests DUnit) CAUsers altracrese Desktop jdk-11.0.2 bin javaw.eve (Fel Writable os210/ds/DoublyLinkedList.java- Eclipse IDE Project Run Window Help Cldlerd cetiae "Deubylisked idjivn ava DataStructures2019 ( impl edu.mccc.cos210.ds9 DoublytLinkedListaddFirst(l COverride public T next) 181 102 103 184 185 186 107 188 109 1108 if (nextNodenull) f throw new java.util.NoSuchElementException); node nextNode; T data nextNode.getData); nextNode nextNode.getNextNode() return data; @Override public void remove) 112 113 114 115 116 if (node == null) { if (node.getNextNode() ) else throw new java.uti1. NoSuchElementException ); null && node.getPrevNode() null)t head = null; tail- null; 118 19 12e 121 if (node.get NextNode() null) ( node.getPrevNode().setNextNode (null); tail = null; y else ( 123 if (node.getPrevNode() null)t node. getNext Node ().setPrevNode (null); head- null; ) else f node.getPrevNode().setNextNode (node.getNextNode)); node.getNextNode().setPrevNode (node.getPrevNode()) node- null; size--j onsole minateds jm OrderedList Tests (JUnitj Ca Users altraore83\Desktop jdk-11.0.2 bin javaw.exe (Feb erro noderedlist-Java-|"DoublyLinkedListjava DataStructures2019> impl edu.mccc.cos210.ds 9 DoublylinkedlistcT:a 134 135 1366 137 1386 private class ReverseIterator implements java.util.Iterator ( private DNode nextNode tail; goverride public boolean hasNext) f 139 140 141 142 143 144 145 if (nextNode == null) { return false; return true; @Override public T next)( 146 if (nextNode-. null) { 147 148 149 150 151 152 153 throw new java.util.NoSuchElementException(); T data = nextNode.getData(); nextNode next Node.getPrevNode); return data; 155 protected class DHode ( 156 157 158 159 160 161 public DoublyLinkedList.DNode next; private DNode nextNode; private DNode prevNode; private T data; public DNode(T data) ( setbata(data); return nextNode; this.nextNode = nextNode; public DNode getNextNode() ( 164 165 public void setNext Node (DNode nextNode) ( 67- 168 Console X sterminateds- jim Orderedlist Tets lUnit] CUser altreore1 Desktop jdk-11,02 binjavaw eve Feb 0 en Writable T) CrderedListjava DoublyLinkedListjava 23 DataStructures2019 (B impredu.mccc.cos210.ds > e DoublyLink T data nextNode.getData(); nextNode = nextNode.getPrevNode ( ); return data; 150 151 152 153 154 155e protected class DNode ( 156 157 158 159 160 161e 162 163 164 165 166 167 168 169 170 public DoublyLinkedList>.DNode prev, public DoublyLinkedList.DNode next private DNode nextNode; private DNode prevNode; private T data; public DNode (T data) f setData(data); public DNode getNextNode) f public void setNext Node (DNode nextNode) t public DNode getPrevNode) ( public void setPrevNode (DNode prevNode) t public T getData) ( public void setData(T data) t return nextNode; this.nextNode next Node; return prevNode this . prevNode prevNode; return data; this.dat a data; onsole 3 terminsteds jm OrderedList Tests I[IUnit] Ca Users altraore38 Desktopljdk-1 hi 55 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7777, 7 Eclipse IDE Search Project Run Window Help package edu.mccc.cos210.ds; 3 public interface IOrderedList extends IDoublylinkedList, java.lang.IterableT 5 public boolean contains(T data); 4 public void add (T data) 6 t this time 0 errors, 2 warnings, 2 others Description > warnings (2 terms) Infos (2 items) Writable Smart Insert 1:1 ccc/cos210/ds/OrderedList.java-Eclipse IDE rch Project Run Window Help OrderedList,java 3 B DataStructures2019 (B impledu.mccc.cos210.d:) e orderedListeT 1 package edu.mccc.cos210.ds; 2 public class OrderedList extends DoublyLinkedLstCT> mplements lorderedListeT>R 4 override 5 public void add(T data) f addFirst (data); addLast (data); 7 9 10 11 12 13 @Override public boolean contains(T data) t boolean head false; java , util . Iterator while (it.hasNext () t iterator(); if(it.next() equals (data)) f 15 016 17 18 return true; return false; 20 return head; 23 l I 24 25 26 @ Console 3 sterminated ijm,OrderedListTests DUnit] CAUsersieltraore88Desktop jdk-11.0.2binljevaw.exe (Feb 0 errors, 2 wa Description FAILURE: makeTypeChar Success: addingAddsLast Warni ntul istContains duta 100 11 @Override public boolean contains (T data) f Console terminateds jim OrderedListTests [JUnit] CAUserslaltraore81Desktoplj Testing: OrderedList FAILURE: makeTypeDouble FAILURE: makeTypeString Success: addingDoesNotContain Success: addingContains_singleEntry Success: integrity_compareToClon ut FAILURE: integrity-compareToSB Success: addingContains_ manyEntries FAILURE makeTypeInt Success makeTypeBoolean FAILURE makeTypeChar Success: addingAddsLast Success: emptyListContains ts.r ||DOrderedlistjava "DoublyLinkedListjava 23 a DataStructures2019 (B impledu.rnccc.cos210.ds > DoublylinkedlistT> > 1 package edu.mccc.cos210.ds; 2 public class DoublylinkedList implements IDoublyLinkedList terat or() 83 { 84 85 86 Override return new ForwardIterator(); 87 public java.util.Iterator reverseIterator) t return new Reverselterator); 89 9 private class ForwardIterator implements java.util.Iterator f 91 92 private DNode node null; private DNode nextNode - head; eoverride 94 public boolean hasNext() f if (nextNode null) ( return false; return true; console X terminateds jim.OrderedList ests DUnit) CAUsers altracrese Desktop jdk-11.0.2 bin javaw.eve (Fel Writable os210/ds/DoublyLinkedList.java- Eclipse IDE Project Run Window Help Cldlerd cetiae "Deubylisked idjivn ava DataStructures2019 ( impl edu.mccc.cos210.ds9 DoublytLinkedListaddFirst(l COverride public T next) 181 102 103 184 185 186 107 188 109 1108 if (nextNodenull) f throw new java.util.NoSuchElementException); node nextNode; T data nextNode.getData); nextNode nextNode.getNextNode() return data; @Override public void remove) 112 113 114 115 116 if (node == null) { if (node.getNextNode() ) else throw new java.uti1. NoSuchElementException ); null && node.getPrevNode() null)t head = null; tail- null; 118 19 12e 121 if (node.get NextNode() null) ( node.getPrevNode().setNextNode (null); tail = null; y else ( 123 if (node.getPrevNode() null)t node. getNext Node ().setPrevNode (null); head- null; ) else f node.getPrevNode().setNextNode (node.getNextNode)); node.getNextNode().setPrevNode (node.getPrevNode()) node- null; size--j onsole minateds jm OrderedList Tests (JUnitj Ca Users altraore83\Desktop jdk-11.0.2 bin javaw.exe (Feb erro noderedlist-Java-|"DoublyLinkedListjava DataStructures2019> impl edu.mccc.cos210.ds 9 DoublylinkedlistcT:a 134 135 1366 137 1386 private class ReverseIterator implements java.util.Iterator ( private DNode nextNode tail; goverride public boolean hasNext) f 139 140 141 142 143 144 145 if (nextNode == null) { return false; return true; @Override public T next)( 146 if (nextNode-. null) { 147 148 149 150 151 152 153 throw new java.util.NoSuchElementException(); T data = nextNode.getData(); nextNode next Node.getPrevNode); return data; 155 protected class DHode ( 156 157 158 159 160 161 public DoublyLinkedList.DNode next; private DNode nextNode; private DNode prevNode; private T data; public DNode(T data) ( setbata(data); return nextNode; this.nextNode = nextNode; public DNode getNextNode() ( 164 165 public void setNext Node (DNode nextNode) ( 67- 168 Console X sterminateds- jim Orderedlist Tets lUnit] CUser altreore1 Desktop jdk-11,02 binjavaw eve Feb 0 en Writable T) CrderedListjava DoublyLinkedListjava 23 DataStructures2019 (B impredu.mccc.cos210.ds > e DoublyLink T data nextNode.getData(); nextNode = nextNode.getPrevNode ( ); return data; 150 151 152 153 154 155e protected class DNode ( 156 157 158 159 160 161e 162 163 164 165 166 167 168 169 170 public DoublyLinkedList>.DNode prev, public DoublyLinkedList.DNode next private DNode nextNode; private DNode prevNode; private T data; public DNode (T data) f setData(data); public DNode getNextNode) f public void setNext Node (DNode nextNode) t public DNode getPrevNode) ( public void setPrevNode (DNode prevNode) t public T getData) ( public void setData(T data) t return nextNode; this.nextNode next Node; return prevNode this . prevNode prevNode; return data; this.dat a data; onsole 3 terminsteds jm OrderedList Tests I[IUnit] Ca Users altraore38 Desktopljdk-1 hi 55 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7777, 7

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions