aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: Techinical Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: Techinical Questions" Watch "B&S: Techinical Questions" New topic
Author

B&S: Techinical Questions

Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Hi and nice day to all... I'm come back again...

So I have some question:

one: In the speification about database file schema say of Overall field... ok... but, what is it... I use for??? (My solution read dinamically the schema structure MagicCookie, Overall & FieldNumer and create the database schema to start read the records... and I use the cookie & field number, but not use a Overall filed )

two: the find() methods say

and the GUI say

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

Ok... but the AND condition, for the find() method specification by Sun is not possible... example

I can choose implemets only OR conditions?

three: This a techical information/choosen... for a "Black Box" concept programmig (for a safety code) I can define my class as final?

I this way I limit the access/manage my classes by not authorized user

Thanks, Laura

[Edit for readability]
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

Hello there. The overall length in the file header can be use to calculate the record number so you can jump to that record instead of reading the entire file each time.

The find method you do need to cater for AND logic. For example:
"Rossi", null => surname only
null, "Laura" => first name only
"Rossi", "Laura" => surname AND first name

As for the final class, what you plan to do with the MyDatabaseClass? I personally think it is possible to have a final class given the purpose. So it comes down how you design your data persistence. For example:
Should the database be single instance (Singleton)?
Do locking within Data class or some other class?

K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
K. Tsang wrote:Hello there. The overall length in the file header can be use to calculate the record number so you can jump to that record instead of reading the entire file each time.

The find method you do need to cater for AND logic. For example:
"Rossi", null => surname only
null, "Laura" => first name only
"Rossi", "Laura" => surname AND first name

As for the final class, what you plan to do with the MyDatabaseClass? I personally think it is possible to have a final class given the purpose. So it comes down how you design your data persistence. For example:
Should the database be single instance (Singleton)?
Do locking within Data class or some other class?


Hi K. Tsang,

thanks for help about the overall fields... I catch on straight away

But...

for the find() methods the Sun specification says:

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")

If I begins the finds (usign the previous sample) in criteria[0] match with Surname and memorize its, then, criteria[1] match with name and save its... in this way is an OR operation... its true???

The is use to force unabled extends my class by anyone...


In this way my code is lock

Hi Laura

[Edit for readability]
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
K. Tsang wrote:Hello there. The overall length in the file header can be use to calculate the record number so you can jump to that record instead of reading the entire file each time.

The find method you do need to cater for AND logic. For example:
"Rossi", null => surname only
null, "Laura" => first name only
"Rossi", "Laura" => surname AND first name

As for the final class, what you plan to do with the MyDatabaseClass? I personally think it is possible to have a final class given the purpose. So it comes down how you design your data persistence. For example:
Should the database be single instance (Singleton)?
Do locking within Data class or some other class?


PROBLEM WITH FORMATTER

Hi K. Tsang,
thanks for help about the overall fields... I catch on straight away
But...
for the find() methods the Sun specification says:

If I begins the finds (usign the previous sample) in criteria[0] match with Surname and memorize its, then, criteria[1] match with name and save its...
in this way is an OR operation... its true???

The final is use to force unabled extends my class by anyone...

In this way my code is lock

Hi Laura
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5593
    
  14

Hi Laura,

regarding your point about the find-method in your data-class and the specification for the gui about searching for records. As you noticed those requirements contradict each other. In my opinion (and that's also how i implemented it myself): you have to do some filtering in your gui, because it is possible that your find-method will return more records than needed. So i use OR in my data find method (also with a startsWith-check) and in my gui i filter the returned records (with exact match and AND to support search on hotelName and location)

This issue is frequently asked and a very common problem. if you search the forum on this issue, you will get a lot of hits. Recently 2 threads have been started about this issue, with more than 50 replies. Some share my opinion, others disagree (so like everything in this assignment it's a decision you have to take and document appropriately). Here you can find both threads:
- Thread 1
- Thread 2

Good luck,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

I don't think you can extend the Data class but you sure can make it final.



For the search, your thinking is correct. Say you find criteria[n] then find criteria[n+1]. Ok now how you going to combine the 2 result sets to produce AND? This is one of the key aspects of SCJD since everyone's searching algorithm can be different.
Laura Pecoraro
Ranch Hand

Joined: Mar 31, 2009
Posts: 45
Thanks

Laura
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: B&S: Techinical Questions