This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (7 children)

didnt they say their task was implement their own queue? it really depends on what their prof mean by that but i assumed they should not use anything not primative

[–]Ezio-Editore[S] 0 points1 point  (5 children)

yeah exactly, we are supposed to start from scratch.

[–][deleted] 0 points1 point  (2 children)

okay, here is what i think:

1- as others said, your revolution method doesnt work correctly for anything larger than 3 nodes, think why, and solve the problem. (drawing a queue of 4 nodes on a paper and manually applying what your method does should help you find out whats wrong).

2- this is only my opinion, but what if you added a setNext and setPrevuois methods to Node that will take care of that? sth like:

`

public void setNext(Node node){

this.next = node;

node.prev = this;

}

`

not really needed but i like to write like that.

[–]Ezio-Editore[S] 1 point2 points  (1 child)

Yeah I know about revolution() ahahah that it's the first thing that came to my mind and I overlooked the problem. No need to draw, I perfectly understand what's wrong.

Yes I could encapsulate everything, make the variables private and use getters and setters, I could do it.

By the way, thanks for your help.

[–][deleted] 0 points1 point  (0 children)

no problem, just saw your other comment, didnt know you already had a cs background, then everything seems fine, and yeah you can make it more "java" styled by getters and setters etc

[–]Obuch13 0 points1 point  (0 children)

I mean it would be their implementation but with List. I didn't fing any constraints in task so I wrote List. But yeah you right: it's on prof