This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: (Contractors) Interface confusion SOS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: (Contractors) Interface confusion SOS" Watch "NX: (Contractors) Interface confusion SOS" New topic
Author

NX: (Contractors) Interface confusion SOS

Zhi Gang
Ranch Hand

Joined: May 03, 2003
Posts: 30
In the interface DB has the below method. I have manage to implement the method in Data.java. However when i start writing for the user interface, i don't see why it needs to return a int[] of record No. rather then a List of String[]
- - - - - - - - - - - - - - - - - - - - - - -
Returns an array of record no that match the specified criteria.
public int[] find(String[] criteria);
- - - - - - - - - - - - - - - - - - - - - - -
Therefore i decided to add another method in the Data class.
Public List getSomeRec(String[] criteria){
blar..
int [] listRecNo = this.find(criteria)
blar...
return someRecord;
}
===========================================
Somehow i am not 100% convince that is allow, please could any one help me, let me know what u think...
Perry Board
Greenhorn

Joined: May 03, 2003
Posts: 29
Why do you want to return an array of Strings? The method is documented as returning an array of "record numbers" so it would be an integer array. The read method would take one of these ints to return a single record.
Zhi Gang
Ranch Hand

Joined: May 03, 2003
Posts: 30
Thanks for reply, yes... you are right, that is what i think, to return it in a String[] sigle record OR list of String[] records, if they found more then one record).
- - - - - - - - - - - - - - - - - - - - -- - -
Public List getSomeRec(String[] criteria){
blar..
int [] arrayRecNo = this.find(criteria)
blar..
String[] record = this.read(recNo)
add this to arrayList of someRecord
return someRecord;
}
- - - - - - - - - - - - - - - - - - - - - - -
Another question, then find method will only called in Data by its own method and it will not appear in GUI lever right? ( coz it make no sense to reply a list of int[] recNo to the Jtable).
i really hope that i am in the right track...
 
wood burning stoves
 
subject: NX: (Contractors) Interface confusion SOS