com.ibm.able.examples.rules
Class GroceryBag
java.lang.Object
com.ibm.able.examples.rules.GroceryBag
- All Implemented Interfaces:
- java.io.Serializable
- public class GroceryBag
- extends java.lang.Object
- implements java.io.Serializable
A grocery bag has an id, and contains items sized small, medium, or large.
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
id
protected int id
numSmallItems
protected int numSmallItems
numMediumItems
protected int numMediumItems
numLargeItems
protected int numLargeItems
GroceryBag
public GroceryBag()
addItem
public void addItem(Grocery item)
removeItem
public void removeItem(Grocery item)
getContents
public java.util.Vector getContents()
getNumLargeItems
public int getNumLargeItems()
getNumMediumItems
public int getNumMediumItems()
getNumItems
public int getNumItems()
getId
public int getId()
hasSpace
public boolean hasSpace(java.lang.String newItemSize)
- Check to see if there is room for a new item.
- Parameters:
newItemSize - The size of the new item.
- Returns:
- true if the bag has space for the new item.
Return false if there is no room for the new item.
reset
public static void reset()
toString
public java.lang.String toString()
contentsAsString
protected java.lang.String contentsAsString()
(C) Copyright IBM Corporation 1999, 2005