|
Building Parsers with Java | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--sjm.examples.coffee.Coffee
A Coffee object represents a type of coffee. Each type of coffee has a name, and may have a former name. Each type also has a roast, which may be Regular, French, or Italian. We offer some types of coffee in two roasts, where French is an alternative to the normal roast. Finally, each type has a country of origin, and a price per pound.
| Field Summary | |
protected boolean |
alsoOfferFrench
|
protected java.lang.String |
country
|
protected java.lang.String |
formerName
|
protected java.lang.String |
name
|
protected double |
price
|
protected java.lang.String |
roast
|
| Constructor Summary | |
Coffee()
|
|
| Method Summary | |
java.lang.Object |
clone()
Return a copy of this object. |
static boolean |
equal(java.lang.Object o1,
java.lang.Object o2)
Compares two objects for equality, treating nulls carefullly, and relying on the first object's implementation of
equals(). |
boolean |
equals(java.lang.Object o)
Compares this object against the specified object. |
boolean |
getAlsoOfferFrench()
Return true, if we offer a french roast version of this coffee in addition to another roast. |
java.lang.String |
getCountry()
Return the country of origin for of this type of coffee's beans. |
java.lang.String |
getFormerName()
Return a former name for this type of coffee. |
java.lang.String |
getName()
Return the name of this type of coffee. |
double |
getPrice()
Return the price per pound of this coffee. |
java.lang.String |
getRoast()
Return the name of the roast of this coffee. |
void |
setAlsoOfferFrench(boolean alsoOfferFrench)
Set the truth of the notion that, in addition to some other type of roast, we offer a french roast version of this coffee. |
void |
setCountry(java.lang.String country)
Set the country of origin for of this type of coffee's beans. |
void |
setFormerName(java.lang.String formerName)
Set a former name of this coffee. |
void |
setName(java.lang.String name)
Set the name of this coffee. |
void |
setPrice(double price)
Set the price per pound of this coffee |
void |
setRoast(java.lang.String roast)
Set the roast of this coffee. |
java.lang.String |
toString()
Return a textual description of this coffee type. |
| Methods inherited from class java.lang.Object |
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected java.lang.String name
protected java.lang.String formerName
protected java.lang.String roast
protected boolean alsoOfferFrench
protected java.lang.String country
protected double price
| Constructor Detail |
public Coffee()
| Method Detail |
public java.lang.Object clone()
public static boolean equal(java.lang.Object o1,
java.lang.Object o2)
equals().o1 - one objecto2 - the othertrue if the objects are equal and
false otherwise.public boolean equals(java.lang.Object o)
true if and only if the argument is
not null and is a Coffee object
whose attributes all equal this object's attributes.o - the object to compare with.true if the objects are equal and
false otherwise.public boolean getAlsoOfferFrench()
public java.lang.String getCountry()
public java.lang.String getFormerName()
public java.lang.String getName()
public double getPrice()
public java.lang.String getRoast()
public void setAlsoOfferFrench(boolean alsoOfferFrench)
boolean - true, if we offer a french roast
version of this coffeepublic void setCountry(java.lang.String country)
String - the countrypublic void setFormerName(java.lang.String formerName)
String - the namepublic void setName(java.lang.String name)
String - the namepublic void setPrice(double price)
double - the pricepublic void setRoast(java.lang.String roast)
String - the roastpublic java.lang.String toString()
|
by Steve Metsker | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||