|
SCJP,SCJD
like above
A data access system that provides record locking and a flexible search mechanism
Originally posted by Leo Tien:
Hi fei xiao:
1) Under 'exact' match, 'Fred' only match 'Fred'. In fact, from the assignment, it has two search mechanism. One is in the client GUI, and another in the DB Access layer. In the GUI search, you must support 'All search' and 'exactly search(include case sensitive)'. This is statement in the assignment:
2) You must let Data.java access the database file directly. But you can create another class do the same work as Data, so you may not use Data.java at all. But this makes any sense?
Make sense?
SCJP,SCJD
Originally posted by fei xiao:
1. Requirement: It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
In my program, I just match the name/location by matches any field
value that begins with criteria. Such as, if with the name 'Fred', then 'Freder', 'Fred' and 'Fred123' will be matched too. Does this meet the requirement of 'exactly match values specified by the user'? Or, I just only math 'Fred', and 'Freder' and 'Fred123' will not match.
I think most people believe that the find method as defined by the Sun-supplied interface does not "exactly match values specified by the user", but is rather a wildcard match (specifically a starts-with match). Therefore, they implement a findExact method that filters the results returned by find, elminating any records from the result set that are not exact matches. This findExact method can exist on the server-side or client-side.
2. Requirement: Your data access class must be called "Data.java".
Now, I create another class, such as "DataAccess.java" to access the database file. And 'Data.java' will not access the database file directly but with the help of 'DataAccess.java'. Does this meet the requirement?
I think this does meet the requirement. There is no requirment that the Data class access the file directly. The only requirement about the Data class is that it must implement the methods declared in the Sun-supplied interface. What you propose is reasonable and I believe several others have done something similar.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
I play Java for fun.<br /> <br />SCJP / SCJD / SCWCD / SCBCD
Originally posted by YungSheng Chang:
This is my way to handle "and/or":
If the TextField value in "Hotel Name" is empty, it means that search criteria is not required. The same rule applies to "City Name".
Regards, George
SCJP, SCJD, SCWCD, SCBCD
I play Java for fun.<br /> <br />SCJP / SCJD / SCWCD / SCBCD
Originally posted by YungSheng Chang:
1. If the textfield value in "Hotel Name" is "Hilton" and the textfield value in "City Name" is "Rapids City", then search for records containing a Hilton hotel in Rapids City --- "And"
2. If the textfield value in "Hotel Name" is "Hilton" and the textfield value is empty, then list out all records with "Hilton" hotel, no matter which city it is in. --- "Or"
3. If the textfield value in "Hotel Name" is empty and the textfield value in "City Name" is "Rapids City", then list out all records in "Rapids City" --- "Or"
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by fei xiao:
2. Requirement: Your data access class must be called "Data.java".
Morgan
SCJP (1.4), SCJD (1.4), SCWCD (1.3), SCBCD (1.3)
1. If the textfield value in "Hotel Name" is "Hilton" and the textfield value in "City Name" is "Rapids City", then search for records containing a Hilton hotel in Rapids City --- "And"
2. If the textfield value in "Hotel Name" is "Hilton" and the textfield value is empty, then list out all records with "Hilton" hotel, no matter which city it is in. --- "Or"
3. If the textfield value in "Hotel Name" is empty and the textfield value in "City Name" is "Rapids City", then list out all records in "Rapids City" --- "Or"
Hi George:
I think what YungSheng means is that use empty value of TextField instead use "*" to identify the wildcard character.
YungSheng, right??
I do not use wild card. It takes more to educate user, and somehow it does not fullfill the "exactly match" requirement(Notice that SUN puts a "must" before the sentence, therefore I do not want to challeng it).
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
Persistence
=========
The Data class implements the DBMain interface specified by Sun. It uses RandomAccessFile directly to get to the file data and provides an in-memory cache (List) of contractor record data. ....
Originally posted by Leo Tien:
Hi George:
What are you think about "Your data access class must be called "Data.java". " then ??
Because Ken use Data read data from db file directly.
Pls comments! Thanx.
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface: DBAccess
Originally posted by Leo Tien:
What are you think about "Your data access class must be called "Data.java". " then ??
Because Ken use Data read data from db file directly.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by George Marinkovich:
So whether the database file is included directly in the Data class, or in some other class that may be included by composition in the Data class, doesn't really matter.
In both cases I think the Data class can be said to provide data access.
Originally posted by Satish Avadhanam:
Hi George, can you please explain what you meant by "database file is included in the Data class"? You meant the access to database file, right? Or is it different?
Regards, George
SCJP, SCJD, SCWCD, SCBCD
The quotation you give is from Ken's recap of his design, not from the assignment instructions, right?
There's nothing wrong with having the db file directly in the Data class. Ken seems to have put it there and I put it there myself.
So whether the database file is included directly in the Data class, or in some other class that may be included by composition in the Data class, doesn't really matter.
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
Squanch that. And squanch this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|