|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.avian.foods.basefoods.StdFood
public class StdFood
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 |
---|
public StdFood()
public StdFood(java.lang.String newContents, java.lang.String newHistory, java.lang.String newType)
newContents
- is the String to put into the contents fieldnewHistory
- is the String to put into the history fieldnewType
- 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"public StdFood(java.lang.String newContents, java.lang.String newHistory, java.lang.String newType, java.lang.String newDescription)
newContents
- is the String to put into the contents fieldnewHistory
- is the String to put into the history fieldnewType
- 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 fieldMethod Detail |
---|
public void setName(java.lang.String newName)
Manna
setName
in interface Manna
newName
- String that is the new name of the food objectpublic java.lang.String getName()
Manna
getName
in interface Manna
public void setDescription(java.lang.String newDescription)
Manna
setDescription
in interface Manna
newDescription
- String that is the description of the food object.public java.lang.String getDescription()
Manna
getDescription
in interface Manna
public java.lang.String getContents()
public void setContents(java.lang.String contents)
contents
- is the String value that should be used for this food's content.public java.lang.String getHistory()
public void setHistory(java.lang.String history)
history
- is the String that will be the new foodHistory.public void addToFoodHistory(java.lang.String historyEvent)
historyEvent
- public java.lang.String getFoodType()
public void setFoodType(java.lang.String foodTypeIN)
foodTypeIN
- is the String that is the name for the type of food.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |