backend.information
Class InformationModel

java.lang.Object
  extended by java.util.Observable
      extended by backend.information.InformationModel
All Implemented Interfaces:
java.util.Observer

public class InformationModel
extends java.util.Observable
implements java.util.Observer

InformationModel is a model of all the information that the user would like to see about our program It takes InformationNuggets and stores them appropriatly. If a class extends InformationNugget then it is perfectly alright to add it to the InformationModel


Constructor Summary
InformationModel()
          InformationModel default constructor
 
Method Summary
 void addNugget(InformationNugget addMe)
          addNugget will add a nugget to the InformationModel
 InformationNugget getLastNuggetAdded()
          getLastNuggetAdded will return the last nugget added to the InformationModel
 InformationNugget getLastNuggetRemoved()
          getLastNuggetRemove returns the last nugget removed from the model
 InformationNugget getNugget(int index)
          getNugget returns the nugget at the specified instance
 int getNuggetCount()
          getNuggetCount returns the amount of nuggets we have stored
 void readNuggetsSphereFile(SphereFileReader myFileReader)
          readNuggetsSphereFile will read information nuggets from a SphereFile and reset the InformationModel as well
 void removeNugget(InformationNugget removeMe)
          removeNugget will remove a nugget from the InformationModel
 void reset()
          reset the InformationModel
 void setAreaActual()
          setAreaActual will change areas to be given just as you would expect.
 void setAreaPercent()
          setAreaPercent will change areas to be computed as a percentage of total area of the sphere
 void setToDegrees()
          The relevant information in the InformationModel will be set to degrees
 void setToRadians()
          The relevent information in the InformationModel will be set to degrees
 void update(java.util.Observable arg0, java.lang.Object arg1)
           
 void writeNuggetsToFile(SphereFileWriter myFileWriter)
          writeNuggetsToFile will write the nuggets in this file out to a SphereFileWriter
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InformationModel

public InformationModel()
InformationModel default constructor

Method Detail

addNugget

public void addNugget(InformationNugget addMe)
addNugget will add a nugget to the InformationModel

Parameters:
addMe - is the nugget to add to the information model

getLastNuggetAdded

public InformationNugget getLastNuggetAdded()
getLastNuggetAdded will return the last nugget added to the InformationModel

Returns:
returns the last nugget added to the InformationModel

update

public void update(java.util.Observable arg0,
                   java.lang.Object arg1)
Specified by:
update in interface java.util.Observer

removeNugget

public void removeNugget(InformationNugget removeMe)
removeNugget will remove a nugget from the InformationModel

Parameters:
removeMe - the nugget to remove

getNuggetCount

public int getNuggetCount()
getNuggetCount returns the amount of nuggets we have stored

Returns:
number of stored nuggets

getNugget

public InformationNugget getNugget(int index)
getNugget returns the nugget at the specified instance

Parameters:
index - the nugget to work with
Returns:
the nugget requsted

getLastNuggetRemoved

public InformationNugget getLastNuggetRemoved()
getLastNuggetRemove returns the last nugget removed from the model

Returns:
The last nugget removed

reset

public void reset()
reset the InformationModel


readNuggetsSphereFile

public void readNuggetsSphereFile(SphereFileReader myFileReader)
readNuggetsSphereFile will read information nuggets from a SphereFile and reset the InformationModel as well

Parameters:
myFileReader - the file to read information nuggets from

writeNuggetsToFile

public void writeNuggetsToFile(SphereFileWriter myFileWriter)
writeNuggetsToFile will write the nuggets in this file out to a SphereFileWriter

Parameters:
myFileWriter - the SphereFileWriter to send the nuggets to

setToDegrees

public void setToDegrees()
The relevant information in the InformationModel will be set to degrees


setToRadians

public void setToRadians()
The relevent information in the InformationModel will be set to degrees


setAreaPercent

public void setAreaPercent()
setAreaPercent will change areas to be computed as a percentage of total area of the sphere


setAreaActual

public void setAreaActual()
setAreaActual will change areas to be given just as you would expect.