a this adds storage of the maindata as an


A. This adds storage of the MainData as an external random access file with id as key to allow ListAll and Query transactions based on id. It also still allows ListAll and Query transactions based on name (using NameIndex) to show the actual data rather than just id (as A1 did).

B. A2 uses binary files (rather than plain ASCII text files) for both MainData file and NameIndexBackup file. NameIndex's save and load methods will thus need changing to accommodate a binary file. And PrettyPrintUtility also has to be changed and extended to deal with these two binary files.

C. Because there is now a lot more processing needed for each raw data record, RawData class must be changed. It will now handle only things pertaining to the RawData FILE, per se (i.e., open it in the constructor, close it in FinishUp method, read a single record/line in InputOneCountry method). The NEW RawDataRecord class (in a physically separate code file) will handle splitting the record into fields, the actual field storage itself, and the appropriate getters and setters for cleaning/converting the fields, as appropriate.

D. This new class provides ready-built services and storage for use by UserApp when processing IN transactions since the restOfTransRecord is exactly the same as a raw data record/line.

E. There will now be additional transaction types and additional transaction handling.

1) New transaction types: LI (ListAllById), QI (QueryById), DI (DeleteById). [DI is a dummy stub, like DN]. LI and QI handlers are in MainData class.

2) IN transactions will now need to call both InsertCountry (in NameIndex class) and InsertCountry (in MainData class).

3) LN (ListAllByName) and QN (QueryByName) transaction handlers (in NameIndex class) will have to call InputThisRecord (in MainData class), supplying the id found in the name index.

F. The actual MainData record will be displayed to the user (in Log file) for LI and QI transactions as well as for LN and QN transactions (via InputThisRecord).

PrepareRecForDisplay (in MainData class) nicely formats the fields into a nice string for UI's WriteThis.

G. An AutoTesterUtility program will be used to automate testing and the demo.

H. Name is now a 15-char string in nameIndex (truncated or space-filled on the right, as needed) since that's how it's stored in the MainData file

RawDataRecord class

This is a NEW class, added for A2. It contains storage for each individual field in the record (NOTE: you only need to specify those needed eventually in the MainData file - see below) It also contains the getters/setters to the necessary cleaning/converting of those fields (e.g., removing excess quote characters, generating id's, truncating/padding some strings to fixed size, converting some strings to integers/floats, etc.). This class provides a public method to ConvertRecToAppropFields which controls the processing of a single record (line) into the properly-configured individual fields.

SetupProgram can then use the appropriate getters (as parameters) when it calls the 2 InsertCountry methods (1st for mainData, 2nd
for nameIndex) - after it calls rawData (file)'s InputOneCountry method (which itself calls rawDataRecord's ConvertRecToAppropFields, supplying it with the wholeRecordAsABigString as a parameter).

Similarly, UserApp can call rawDataRecord.ConvertRecToAppropFields in the IN transaction handler (in the big switch statement) before calling the 2 InsertCountry methods.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: a this adds storage of the maindata as an
Reference No:- TGS0442225

Now Priced at $25 (50% Discount)

Recommended (93%)

Rated (4.5/5)