In my B&S assignment the Interface states that I have to use a recNo for identifying records. I can not find any "must" statements on what this recNo actually represent. So far I have used recNo as the offset of a record, and implemented it as a member in Contractor to preserv it. I do not wish to use a Map or similar to map between record offsets to e.g. number 1,2,3 as these numbers are not necessary for any logcal code.
record number is integer while the location in the file is long, I think it would be much better if you consider the record number as its order in records in the file... that's what I am doing, of course that will cause you to use some sort of mapipng (HashMap) to map record number with its location in the file.
You Defiantly you don't need to save the record number in the Contractor class (dealing with like name, location etc) and I think you _shouldn't_.
SCBCD - SCWCD - SCJD - SCJP - OCA
Joined: Oct 17, 2007
My record number (recNo in interface) is not integer but long. There is no description of record number in the interface. I still can't see why this HAS to be the order in the database...
Joined: Aug 06, 2007
Ok, in my assignment the recNo is int, we are probably working on a different version.
Don't you think that this is kind of misleading, I mean record number (recNo) is different from record offset. I told you the way i did it and I think it is cleaner, I agree that you will have to use a HashMap to map the record number to its offset but I think it is worth it. It's your call after all.
In my assignment, the record number has the type long, too.
However, in my assignment, the number of bytes per record is fixed. So, it is no problem to calculate the file offset from the record number (I read the database header where the fields and their length are defined when the server is started).