hey wondering if anyone can help me with some work im doing
im trying to remove a record from a queue by using a method from a class.
class QueueNode
{
private String document ;
private String owner ;
private int size ;
private QueueNode next ;
private QueueNode previous ;
public QueueNode (String document , String owner , int size)
{
this.document = document ;
this.owner = owner ;
this.size = size ;
next = null ;
previous = null ;
}
public String getDocument()
{
return document ;
}
public String getOwner()
{
return owner ;
}
public int getSize()
{
return size ;
}
public QueueNode getNext()
{
return next ;
}
public QueueNode getPrevious()
{
return previous ;
}
public void setDocument(Str ing document)
{
this.document = document ;
}
public void setOwner(String owner)
{
this.owner = owner ;
}
public void setSize(int size)
{
this.size = size;
}
public void setNext(QueueNo de next)
{
this.next = next ;
}
public void setPrevious(Que ueNode previous) //this is the part im having trouble with
{
this.previous = previous ;
}
}
class Queue
{
private QueueNode start ;
private QueueNode end ;
public Queue ()
{
start = new QueueNode("","" ,0) ;
start = null ;
end = new QueueNode("","" ,0) ;
end = null ;
}
public void add ( String document, String owner, int size )
{
if ( start == null )
{
start = new QueueNode(docum ent,owner,size) ;
end = start ;
}
else
{
QueueNode temp = new QueueNode(docum ent,owner,size) ;
temp.setNext (end) ;
end.setPrevious (temp) ;
end = temp ;
}
}
public boolean isEmpty ()
{
return ( start == null) ;
}
public QueueNode remove ()
{
QueueNode temp = new QueueNode("","" ,0) ;
if ( start == null )
return null ;
else if ( start.setPrevio us == null)
{
temp = start ;
start = null ;
return temp ;
}
else
{
temp = start ;
start = start.setPrevio us ;
return temp ;
}
}
public void displayAll ()
{
QueueNode temp = new QueueNode ("","",0) ;
temp = start ;
while ( temp ! = null )
{
System.out.prin tln ( "Document: " + temp.getDocumen t() ) ;
System.out.prin tln ( "Owner: " + temp.getOwner() ) ;
System.out.prin tln ( "Size: " + temp.getSize() ) ;
temp = temp.setPreviou s ;
}
}
}
and these are the errors im getting
Queue.java:47: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
else if ( start.setPrevio us == null)
^
Queue.java:56: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
start = start.setPrevio us ;
^
Queue.java:74: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
temp = temp.setPreviou s ;
^
3 errors
so im not calling setPrevious properly but whats wrong with it?
any help appreciated
thanks
im trying to remove a record from a queue by using a method from a class.
class QueueNode
{
private String document ;
private String owner ;
private int size ;
private QueueNode next ;
private QueueNode previous ;
public QueueNode (String document , String owner , int size)
{
this.document = document ;
this.owner = owner ;
this.size = size ;
next = null ;
previous = null ;
}
public String getDocument()
{
return document ;
}
public String getOwner()
{
return owner ;
}
public int getSize()
{
return size ;
}
public QueueNode getNext()
{
return next ;
}
public QueueNode getPrevious()
{
return previous ;
}
public void setDocument(Str ing document)
{
this.document = document ;
}
public void setOwner(String owner)
{
this.owner = owner ;
}
public void setSize(int size)
{
this.size = size;
}
public void setNext(QueueNo de next)
{
this.next = next ;
}
public void setPrevious(Que ueNode previous) //this is the part im having trouble with
{
this.previous = previous ;
}
}
class Queue
{
private QueueNode start ;
private QueueNode end ;
public Queue ()
{
start = new QueueNode("","" ,0) ;
start = null ;
end = new QueueNode("","" ,0) ;
end = null ;
}
public void add ( String document, String owner, int size )
{
if ( start == null )
{
start = new QueueNode(docum ent,owner,size) ;
end = start ;
}
else
{
QueueNode temp = new QueueNode(docum ent,owner,size) ;
temp.setNext (end) ;
end.setPrevious (temp) ;
end = temp ;
}
}
public boolean isEmpty ()
{
return ( start == null) ;
}
public QueueNode remove ()
{
QueueNode temp = new QueueNode("","" ,0) ;
if ( start == null )
return null ;
else if ( start.setPrevio us == null)
{
temp = start ;
start = null ;
return temp ;
}
else
{
temp = start ;
start = start.setPrevio us ;
return temp ;
}
}
public void displayAll ()
{
QueueNode temp = new QueueNode ("","",0) ;
temp = start ;
while ( temp ! = null )
{
System.out.prin tln ( "Document: " + temp.getDocumen t() ) ;
System.out.prin tln ( "Owner: " + temp.getOwner() ) ;
System.out.prin tln ( "Size: " + temp.getSize() ) ;
temp = temp.setPreviou s ;
}
}
}
and these are the errors im getting
Queue.java:47: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
else if ( start.setPrevio us == null)
^
Queue.java:56: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
start = start.setPrevio us ;
^
Queue.java:74: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
temp = temp.setPreviou s ;
^
3 errors
so im not calling setPrevious properly but whats wrong with it?
any help appreciated
thanks
Comment