Tasks:
1. Read input from a file
2. Parse input into commands and data.
3. Perform insertions, deletions searches and printouts.
4. Create and maintain data storage.
5. Respond as to success or failure of actions.
6. Write output to file.
///////////////////////////////////////////////////////////////////Breakdown
level 1:
Open and read input from a file. This component will take a filename, open a
file and read lines from it. When it reaches the end of file, it will close
the file.
Input: file name
Output: character array containing a line from the file.
Tasks:
1. Open file and create stream to it.
2. Read in a line from the file
3. Close the file.
Parse input into commands and data. This component will take one line of input
and determine if it is a valid input. It will determine what the command is,
and what the data record is.
Input: line of input
Output: command and data: possibly a structure?
Tasks:
1. Parse input
2. Validate input
Perform insertions, deletions, searches and printouts.
Inputs: command and (possibly) data
Output: Success or failure of action; address if applicable
Tasks:
1. Inset record into data structure
2. Delete record from data structure
3. Search for record from data structure
4. Traverse the data structure, returning the data and address of each element
Create and maintain data storage. This component will create a data structure.
It will hold and store records.
Inputs: structure size
Outputs: success or failure of action
Tasks:
1. Create structure based on input size.
Respond as to success or failure of actions. This component will determine
the outcome of the actions of the insertion component, and create a message
to output.
Input: Action outcome
Output: Action outcome message
Tasks:
1. Identify the outcome
2. Translate into output message.
Write output to file. This component will open a file, create a stream to it,
and write program output to a file of specific filename.
Input: file name, message string
Output: file write.
Tasks:
1. Open file with name specified.
2. When message arrives, write to file
3. Close file.
//////////////////////////////////////////////////////////////////////Breakdown
level 2
Inset record into data structure. This component will create a pseudo-key for
the record. It will then traverse the structure to find where the record belongs.
It will then put the record into the structure.
Input: record
Output: success/ address
Tasks
1. Hash record to find pseudo=key
2. find location in structure
3. add record (needs further breakdown)
Delete record. This component will create a pseudo-key for the record. It will
then traverse the structure to find the record. It will then remove the record.
Input: record
Output: success/ address
Tasks:
1. Hash record to find pseudo-key
2. find location in structure
3. remove record (may need further breakdown
Search for record from data structure. This component will create a pseudo-
key for the record. It will then traverse the structure to find the record.
Its location will then be returned.
Input: record
Output: success/ address
Tasks:
1. Hash record to find pseudo-key
2. find location in structure
3. return address
Traverse the data structure, returning the data and address of each element.
This component will traverse the structure, returning the address and data from
each record contained within it.
Input: none
Output: contents of the entire data structure
Tasks:
1. Traverse structure
2. Return each record and its address.