com.avian.foods.basefoods
Class StdFood

java.lang.Object
  extended by com.avian.foods.basefoods.StdFood
All Implemented Interfaces:
Manna
Direct Known Subclasses:
CombinedFood, Err, FirstName, Fork1, Fork2, Fork3, Fork4, Fork5, Fork6, Fork7, Fork8, Fork9, LastName, StateZipPop

public class StdFood
extends java.lang.Object
implements Manna

The contents of this food object is the "work package" that birds digest. StdFood uses a String object as a work package, but other food objects could use other objects for their contents. For example, the contents object could contain 2 fields, f1 & f2 and the next food object would have a contents constructor that used the 2 fields object to create a new contents object with 3 fields (f1, f2, & f3), etc. This object also maintains a history of the events that happened to it (who ate it).


Constructor Summary
StdFood()
          Default constructor for this food, it sets a few reasonable values for its variables.
StdFood(java.lang.String newContents, java.lang.String newHistory, java.lang.String newType)
          Constructor for this food that sets its variables to the params that were passed in.
StdFood(java.lang.String newContents, java.lang.String newHistory, java.lang.String newType, java.lang.String newDescription)
          Constructor for this food that sets its variables to the params that were passed in.
 
Method Summary
 void addToFoodHistory(java.lang.String historyEvent)
          Adds a formatted event to the food's history.
 java.lang.String getContents()
          Returns the contents field, which is the work package that the birds digest.
 java.lang.String getDescription()
          Gets the description of this food object.
 java.lang.String getFoodType()
          Returns the String name for the type of food that is this food object.
 java.lang.String getHistory()
          Returns the String contained in the history field.
 java.lang.String getName()
          Gets the name of the food, just in case we're not sure what we're eating or because we want to record or display what's being eaten.
 void setContents(java.lang.String contents)
          Sets the value of the contents object, in this case, as String.
 void setDescription(java.lang.String newDescription)
          Each time a bird stores a food object with a new key (name), it should also provide a new description of the food object.
 void setFoodType(java.lang.String foodTypeIN)
          Sets the type of food using the String that was passed as a parameter.
 void setHistory(java.lang.String history)
          Sets this food object's foodHistory field with the String value passed as a parameter.
 void setName(java.lang.String newName)
          Each time a bird stores a food object with a new key (name), it should also set the new name in the food object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StdFood

public StdFood()
Default constructor for this food, it sets a few reasonable values for its variables.


StdFood

public StdFood(java.lang.String newContents,
               java.lang.String newHistory,
               java.lang.String newType)
Constructor for this food that sets its variables to the params that were passed in.

Parameters:
newContents - is the String to put into the contents field
newHistory - is the String to put into the history field
newType - is the String that represents the type food or the String "FILE_OP" if the food type that was passed in from the Aviary equals "N/A"

StdFood

public StdFood(java.lang.String newContents,
               java.lang.String newHistory,
               java.lang.String newType,
               java.lang.String newDescription)
Constructor for this food that sets its variables to the params that were passed in.

Parameters:
newContents - is the String to put into the contents field
newHistory - is the String to put into the history field
newType - is the String that represents the type food or the String "FILE_OP" if the food type that was passed in from the Aviary equals "N/A"
newDescription - is the String to put into the Description field
Method Detail

setName

public void setName(java.lang.String newName)
Description copied from interface: Manna
Each time a bird stores a food object with a new key (name), it should also set the new name in the food object.

Specified by:
setName in interface Manna
Parameters:
newName - String that is the new name of the food object

getName

public java.lang.String getName()
Description copied from interface: Manna
Gets the name of the food, just in case we're not sure what we're eating or because we want to record or display what's being eaten.

Specified by:
getName in interface Manna
Returns:
String with the name of the food object

setDescription

public void setDescription(java.lang.String newDescription)
Description copied from interface: Manna
Each time a bird stores a food object with a new key (name), it should also provide a new description of the food object.

Specified by:
setDescription in interface Manna
Parameters:
newDescription - String that is the description of the food object.

getDescription

public java.lang.String getDescription()
Description copied from interface: Manna
Gets the description of this food object.

Specified by:
getDescription in interface Manna
Returns:
String that described what this food object does or tastes like.

getContents

public java.lang.String getContents()
Returns the contents field, which is the work package that the birds digest.

Returns:
String with the value in the contents field. If a food implemented a different object as its contents, that type of object would be returned and the calling bird would have to know what to do with that type of object.

setContents

public void setContents(java.lang.String contents)
Sets the value of the contents object, in this case, as String.

Parameters:
contents - is the String value that should be used for this food's content.

getHistory

public java.lang.String getHistory()
Returns the String contained in the history field.

Returns:
String with the contents of the foodHistory field.

setHistory

public void setHistory(java.lang.String history)
Sets this food object's foodHistory field with the String value passed as a parameter. If a foodHistory existed, it is replaced by the one that is passed as a parameter instead of adding to it's history. This method is not used as often as addToFoodHistory.

Parameters:
history - is the String that will be the new foodHistory.

addToFoodHistory

public void addToFoodHistory(java.lang.String historyEvent)
Adds a formatted event to the food's history. The formatting includes a millisecond time, the food type, and the event that was passed in, all on one line, with each piece separated by commas so it can be read as a .csv file.

Parameters:
historyEvent -

getFoodType

public java.lang.String getFoodType()
Returns the String name for the type of food that is this food object.

Returns:
String name of the food object

setFoodType

public void setFoodType(java.lang.String foodTypeIN)
Sets the type of food using the String that was passed as a parameter.

Parameters:
foodTypeIN - is the String that is the name for the type of food.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object