ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.examples.rules
Class GroceryBag

java.lang.Object
  extended bycom.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

Field Summary
protected  int id
           
protected  int numLargeItems
           
protected  int numMediumItems
           
protected  int numSmallItems
           
 
Constructor Summary
GroceryBag()
           
 
Method Summary
 void addItem(Grocery item)
           
protected  java.lang.String contentsAsString()
           
 java.util.Vector getContents()
           
 int getId()
           
 int getNumItems()
           
 int getNumLargeItems()
           
 int getNumMediumItems()
           
 boolean hasSpace(java.lang.String newItemSize)
          Check to see if there is room for a new item.
 void removeItem(Grocery item)
           
static void reset()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id

numSmallItems

protected int numSmallItems

numMediumItems

protected int numMediumItems

numLargeItems

protected int numLargeItems
Constructor Detail

GroceryBag

public GroceryBag()
Method Detail

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()

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005