tutorial.survey
Class SurveyDatabase

java.lang.Object
  |
  +--tutorial.survey.SurveyDatabase

public class SurveyDatabase
extends java.lang.Object

Acts like an in-memory database of survey information.


Constructor Summary
SurveyDatabase()
           
 
Method Summary
 void addSurvey(Survey survey)
          Assigns a primary key to the survey, then stores a clone of it into the database.
 void deleteSurvey(java.lang.Object primaryKey)
           
 Survey[] getAllSurveys()
          Returns an array of copies of all Surveys stored in the database.
 Survey getSurvey(java.lang.Object primaryKey)
          Returns a clone of the survey with the given primary key, or null if not found.
 int getSurveyCount()
          Returns the number of surveys in the database.
 void updateSurvey(Survey survey)
          Stores a clone of the survey, replacing any previous version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurveyDatabase

public SurveyDatabase()
Method Detail

addSurvey

public void addSurvey(Survey survey)
Assigns a primary key to the survey, then stores a clone of it into the database.

getSurveyCount

public int getSurveyCount()
Returns the number of surveys in the database.

getAllSurveys

public Survey[] getAllSurveys()
Returns an array of copies of all Surveys stored in the database.

getSurvey

public Survey getSurvey(java.lang.Object primaryKey)
Returns a clone of the survey with the given primary key, or null if not found.

deleteSurvey

public void deleteSurvey(java.lang.Object primaryKey)

updateSurvey

public void updateSurvey(Survey survey)
Stores a clone of the survey, replacing any previous version.