|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectOrder
public class Order
An order (mapping from commdities to integers). CS 537, Spring 2007, Project 2.
Constructor Summary | |
---|---|
Order()
Creates a new Order with all amounts zero. |
Method Summary | |
---|---|
void |
change(Grain g,
int diff)
Changes the mount of "g" by "diff". |
Order |
copy()
Returns a copy of this Order. |
int |
get(Grain g)
Gets the amount of "g" in this order. |
void |
set(Grain g,
int n)
Sets the amount of "g" to "n". |
String |
toString()
Returns a readable version of this order. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Order()
Method Detail |
---|
public String toString()
toString
in class Object
public int get(Grain g)
g
- the grain
public void set(Grain g, int n)
g
- a grainn
- the amount of grain gpublic void change(Grain g, int diff)
g
- a graindiff
- the change in the amount of grain gpublic Order copy()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |