Class Order

Object
  extended by Order

public class Order
extends Object

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

Order

public Order()
Creates a new Order with all amounts zero.

Method Detail

toString

public String toString()
Returns a readable version of this order.

Overrides:
toString in class Object
Returns:
a readable version of this order.

get

public int get(Grain g)
Gets the amount of "g" in this order.

Parameters:
g - the grain
Returns:
the amount of grain g

set

public void set(Grain g,
                int n)
Sets the amount of "g" to "n".

Parameters:
g - a grain
n - the amount of grain g

change

public void change(Grain g,
                   int diff)
Changes the mount of "g" by "diff".

Parameters:
g - a grain
diff - the change in the amount of grain g

copy

public Order copy()
Returns a copy of this Order.

Returns:
a copy of this Order.