goldengine.java
Class SimpleDatabase

java.lang.Object
  |
  +--goldengine.java.SimpleDatabase
All Implemented Interfaces:
EntryContentConstants

public class SimpleDatabase
extends java.lang.Object
implements EntryContentConstants

-------------------------------------------------------------------------------------------
Source File: SimpleDatabase.java
Author: Devin Cook, Matthew Hawkins
Description: A class written to open a binary cgt file (written in VB), and read its contents for simple database records.
-------------------------------------------------------------------------------------------
Revision List

      Author          Version         Description
      ------          -------         -----------
      MPH             1.0             First Issue
		MPH				1.1				Bug fixed where getNextRecord would always be false.

-------------------------------------------------------------------------------------------
IMPORT: java.io, java.util
-------------------------------------------------------------------------------------------


Fields inherited from interface goldengine.java.EntryContentConstants
entryContentBoolean, entryContentByte, entryContentEmpty, entryContentInteger, entryContentString
 
Constructor Summary
SimpleDatabase()
           
 
Method Summary
 void clear()
          clear This method will reset all the currently read fields.
 void closeFile()
          closeFile This method will close the file and set the Buffer to null.
 boolean done()
          done This method will check to see if we have reached the end of the file.
 java.lang.String getFileType()
          getFileType This method will return what file type this Database instance can read.
 boolean getNextRecord()
          getNextRecord #ver1.1# This method will read the file for the next record, and place each field in the Vector to be retrieved later.
 boolean openFile(java.lang.String fileName)
          openFile This method will open the file for reading.
 int[] retrieve(int numParams)
          retrieve This method will retrieve a set of integers that have been read by the SimpleDatabase file.
 boolean retrieveDone()
          retrieveDone This method checks to see if there no many fields or records to be read.
 java.lang.Object retrieveNext()
          retrieveNext This method will retrieve an Object that has been read in by the SimpleDatabase.
 void setFileType(java.lang.String newFileType)
          setFileType This method will identify what file can be read by the simple database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDatabase

public SimpleDatabase()
Method Detail

retrieve

public int[] retrieve(int numParams)
retrieve This method will retrieve a set of integers that have been read by the SimpleDatabase file.
Parameters:
numParams - The number of records to return.
Returns:
The int array holds the integers associated with the record.

retrieveDone

public boolean retrieveDone()
retrieveDone This method checks to see if there no many fields or records to be read.
Returns:
True if there are no many fields to retrieve, false if there is.

retrieveNext

public java.lang.Object retrieveNext()
retrieveNext This method will retrieve an Object that has been read in by the SimpleDatabase. It could be a String, Boolean etc.
Returns:
The next field.

openFile

public boolean openFile(java.lang.String fileName)
                 throws ParserException
openFile This method will open the file for reading.
Parameters:
fileName - the absolute pathname of the file to read.
Returns:
Will return true if the file was opened, false if there was an IOException, or if there was an invalid file header.
Throws:
ParserException - Thrown if there is a problem with the stream.

closeFile

public void closeFile()
               throws ParserException
closeFile This method will close the file and set the Buffer to null.
Throws:
ParserException - If there was a problem closing the file.

setFileType

public void setFileType(java.lang.String newFileType)
setFileType This method will identify what file can be read by the simple database.
Parameters:
newFileType - The file type to read.

getFileType

public java.lang.String getFileType()
getFileType This method will return what file type this Database instance can read.
Returns:
The file type.

done

public boolean done()
             throws ParserException
done This method will check to see if we have reached the end of the file.
Returns:
True if the end of the file has been reached, false if not.
Throws:
ParserException - If there was a problem with reading the stream.

getNextRecord

public boolean getNextRecord()
                      throws ParserException
getNextRecord #ver1.1# This method will read the file for the next record, and place each field in the Vector to be retrieved later.

ver1.1 Found bug where it would always return false.

Returns:
True if there was no problems getting the next record, and false if there was.
Throws:
ParserException - If there was some problem with the stream.

clear

public void clear()
clear This method will reset all the currently read fields.