Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
306
306Ass4
Commits
6da8ebcb
Commit
6da8ebcb
authored
Feb 25, 2019
by
michael lundquist
Browse files
The Doubly linked classes now work, but still aren't commented.
parent
849256d4
Pipeline
#3989
passed with stage
in 1 minute and 18 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fourthassignment/src/main/java/com/ds/fourthassignment/DoublyLNode.java
View file @
6da8ebcb
...
...
@@ -2,10 +2,11 @@ package com.ds.fourthassignment;
/**
* This now supports the scientist type
*
* @author Michael Lundquist
*/
public
class
DoublyLNode
{
private
Scientist
data
;
private
DoublyLNode
next
;
private
DoublyLNode
previous
;
...
...
fourthassignment/src/main/java/com/ds/fourthassignment/DoublyLinkedList.java
View file @
6da8ebcb
package
com.ds.fourthassignment
;
/**
*
* @author Michael Lundquist
*/
public
class
DoublyLinkedList
{
private
DoublyLNode
head
;
...
...
@@ -91,17 +95,16 @@ public class DoublyLinkedList {
* @return the index of this scientist, or -1
*/
public
int
indexOfElement
(
Scientist
s
){
DoublyLNode
curNode
=
head
;
int
curIndex
=
0
;
do
{
for
(
DoublyLNode
curNode
=
this
.
head
;
curNode
!=
null
;
curIndex
++,
curNode
=
curNode
.
getNext
()
){
if
(
curNode
.
getData
().
compareTo
(
s
)
==
0
){
return
curIndex
;
}
curNode
=
curNode
.
getNext
();
curIndex
++;
}
while
(
curNode
.
hasNext
());
}
return
-
1
;
}
}
}
\ No newline at end of file
fourthassignment/src/main/java/com/ds/fourthassignment/LNode.java
View file @
6da8ebcb
package
com.ds.fourthassignment
;
/**
*
* @author Michael Lundquist
*/
public
class
LNode
{
Integer
data
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment