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(String document)
{
this.document = document ;
}
public void setOwner(String owner)
{
this.owner = owner ;
}
public void setSize(int size)
{
this.size = size;
}
public void setNext(QueueNode next)
{
this.next = next ;
}
public void setPrevious(QueueNode 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(document,owner,size) ;
end = start ;
}
else
{
QueueNode temp = new QueueNode(document,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.setPrevious == null)
{
temp = start ;
start = null ;
return temp ;
}
else
{
temp = start ;
start = start.setPrevious ;
return temp ;
}
}
public void displayAll ()
{
QueueNode temp = new QueueNode ("","",0) ;
temp = start ;
while ( temp ! = null )
{
System.out.println ( "Document: " + temp.getDocument() ) ;
System.out.println ( "Owner: " + temp.getOwner() ) ;
System.out.println ( "Size: " + temp.getSize() ) ;
temp = temp.setPrevious ;
}
}
}
and these are the errors im getting
Queue.java:47: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
else if ( start.setPrevious == null)
^
Queue.java:56: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
start = start.setPrevious ;
^
Queue.java:74: cannot resolve symbol
symbol : variable setPrevious
location: class QueueNode
temp = temp.setPrevious ;
^
3 errors
so im not calling setPrevious properly but whats wrong with it?
any help appreciated
thanks
7 1939
Your method: -
public void setPrevious(QueueNode previous) //this is the part im having trouble with
-
{
-
this.previous = previous ;
-
}
-
... can only be called like this: -
someObject.setPrevious(somePreviousNode);
-
Simply put: you forgot the parentheses and the single parameter.
kind regards,
Jos
hey wondering if anyone can help me with some coursework im doing
im trying to remove a record from a queue by using a method from another 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(String document)
-
{
-
this.document = document ;
-
}
-
-
public void setOwner(String owner)
-
{
-
this.owner = owner ;
-
}
-
-
public void setSize(int size)
-
{
-
this.size = size;
-
}
-
-
public void setNext(QueueNode next)
-
{
-
this.next = next ;
-
}
-
-
public void setPrevious(QueueNode previous)
-
{
-
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(document,owner,size) ;
-
end = start ;
-
-
}
-
-
else
-
{
-
QueueNode temp = new QueueNode(document,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.setPrevious == null)
-
{
-
temp = start ;
-
start = null ;
-
return temp ;
-
}
-
else
-
{
-
temp = start ;
-
start = start.setPrevious ;
-
return temp ;
-
}
-
}
-
-
public void displayAll ()
-
{
-
-
QueueNode temp = new QueueNode ("","",0) ;
-
temp = start ;
-
while ( temp ! = null )
-
{
-
-
System.out.println ( "Document: " + temp.getDocument() ) ;
-
System.out.println ( "Owner: " + temp.getOwner() ) ;
-
System.out.println ( "Size: " + temp.getSize() ) ;
-
temp = temp.setPrevious ;
-
-
}
-
}
-
}
-
and these are the errors im getting - Queue.java:47: cannot resolve symbol
-
symbol : variable setPrevious
-
location: class QueueNode
-
else if ( start.setPrevious == null)
-
^
-
Queue.java:56: cannot resolve symbol
-
symbol : variable setPrevious
-
location: class QueueNode
-
start = start.setPrevious ;
-
^
-
Queue.java:74: cannot resolve symbol
-
symbol : variable setPrevious
-
location: class QueueNode
-
temp = temp.setPrevious ;
-
^
-
3 errors
-
what do i have to change?
i did get a reply but it didnt make much sense to me (sorry jos)
thanks
See how you wrote line 98 above. That's how you should call a method.
In addition to not actually calling your functions, when setting something equal to the previous entry, you would need to use get, rather than set. This is found in all three errors.
What is wrong with my answer in your other identical thread?
Don't double post and stick to one thread for one problem.
kind regards,
Jos
What is wrong with my answer in your other identical thread?
Don't double post and stick to one thread for one problem.
kind regards,
Jos
Argh.
<shakes head>
jomcfall97,
You are skating on thin ice. Double posting, not using [code] tags, and generally being dense are among your infractions. If Jos's post did not make sense to you then politely ask him to explain.
You need to read the posting guidelines, because the next problem might result in a 5-7 day ban on your account.
-MODERATOR
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Gary |
last post by:
sorry for not cross-posting originally (originally posted in the components
subgroup)
I seem to have run into two documented bugs whose workarounds are
incompatible. What I have is an OCX...
|
by: Mark Gillespie |
last post by:
I have a class that launches a process (amongst other things). I keep
track of the process handle, and just prior to the obejct being destroyed
by the garbage collector, I want to kill that...
|
by: Nick Flandry |
last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my
development environment (Win2K server running IIS 5) and a test environment (also Win2K server
running IIS...
|
by: Tim::.. |
last post by:
Hi,
Can someone please tell me why this doesn't work! I keep getting an error in
the build saying!
"Argument not specified for parameter 'e' of Public Sub PopulateDropdown..."
I would be...
|
by: James |
last post by:
I have a VB windows forms application that accesses a Microsoft Access
database that has been secured using user-level security. The
application is being deployed using No-Touch deployment. The...
|
by: zq |
last post by:
Hi!
I am have a COM object which occupies more and more memory everytime it's
used.
The "VM size" counter (private bytes) of the process that uses the COM
object keeps on growing when...
|
by: Thomas Due |
last post by:
Hi,
I manage an rather old application in which we have some fairly complex (ugly) Delphi code. This is Delphi 6 we're talking about.
Among all this Delphi code there is method for formating a...
|
by: =?Utf-8?B?Sm9obiBT?= |
last post by:
I am trying to find out if there is a way to tell if there is already a
filesystemwatcher (created by a webservice) monitoring a folder.
I have a webservice that creates a filesystemwatcher,...
|
by: Mohamed Mansour |
last post by:
Hey there, this will be somewhat a long post, but any response is
appreciated!
I have done many PInvoke in the past from C++ to C#, but I did PInvoke
within C# not C++/CLI.
Can someone explain...
|
by: =?Utf-8?B?RGF2ZSBIZXJybWFubg==?= |
last post by:
I have a web service (.NET 2.0) that defines a method with two input
parameters. Both of these input parameters are defined as "int". This web
service is running on a 32-bit machine. There is a...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |