|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectSlot
Defines a storage class to store information about a single product slot inside the machine.
| Field Summary | |
(package private) int |
cans
|
(package private) int |
dropped
|
(package private) boolean |
enabled
|
(package private) int |
index
|
(package private) String |
name
|
(package private) int |
price
|
| Constructor Summary | |
Slot()
Default constructor - initialize all the private variables to default values |
|
Slot(int index,
String name,
int cans,
int dropped,
int price,
boolean enabled)
Construct a Slot from supplied values. |
|
| Method Summary | |
boolean |
equals(Slot other)
|
int |
getCans()
Returns the number of cans left in the slot |
int |
getDropped()
Returns the number of cans that have been dropped from this slot. |
int |
getIndex()
Returns the index of this slot. |
String |
getName()
Returns the name or drink in the slot |
int |
getPrice()
Returns the price of the slot in credits (cents). |
boolean |
isEnabled()
Returns whether or not the slot is enabled. |
void |
setCans(int _cans)
Changes the number of cans available from the slot. |
void |
setDropped(int _dropped)
Changes the number of cans dropped from this slot. |
void |
setEnabled(boolean _enabled)
Sets whether or not this slot is enabled. |
void |
setIndex(int _index)
Changes/sets the index of this slot. |
void |
setName(String _name)
Changes the name of the slot. |
void |
setPrice(int _price)
Changes this slots price. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
int index
String name
int cans
int dropped
int price
boolean enabled
| Constructor Detail |
public Slot()
public Slot(int index,
String name,
int cans,
int dropped,
int price,
boolean enabled)
index - The index of the slot. Indicies are zero based.name - The slots name.cans - The number of cans of product left in the slotdropped - The number of cans that have come out of the slot.price - The price of the product.enabled - Whether or not the slot is enabled.| Method Detail |
public int getIndex()
public String getName()
public int getCans()
public int getDropped()
public int getPrice()
public boolean isEnabled()
public void setIndex(int _index)
_index - The new index of this slot.public void setName(String _name)
_name - The new name for the slot.public void setCans(int _cans)
_cans - The number of available cans.public void setDropped(int _dropped)
_dropped - The number of cans dropped from this slot.public void setPrice(int _price)
_price - This slots new price.public void setEnabled(boolean _enabled)
_enabled - If true, then the slot is enabled.
Else, the slot is disabled.public boolean equals(Slot other)
public String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||