type.lib
Class Supplier

java.lang.Object
  extended by type.lib.Contact
      extended by type.lib.Supplier
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Contact>

public class Supplier
extends Contact
implements java.io.Serializable

This class encapsulates a supplier. A supplier is a contact with a catalog listing all items it supplies and their prices.

This class aggregates the catalog map via a regular aggregation, not a composition.

Version:
7.0 - Summer 2010
Author:
H. Roumani, roumani@cse.yorku.ca
See Also:
Serialized Form

Field Summary
 
Fields inherited from class type.lib.Contact
FIRST_NUMBER
 
Constructor Summary
Supplier(java.lang.String name, java.lang.String address)
          Construct a supplier having the indicated name and address, and assign a unique number and an empty catalog of type HashMap to it.
Supplier(java.lang.String name, java.lang.String address, java.util.Map<Item,java.lang.Double> catalog)
          Construct a supplier having the indicated name, address, and catalog, and assign a unique number to it.
 
Method Summary
 java.util.Map<Item,java.lang.Double> getCatalog()
          Determine the catalog this supplier.
 void setCatalog(java.util.Map<Item,java.lang.Double> catalog)
          Set the catalog of this supplier to the passed one.
 
Methods inherited from class type.lib.Contact
compareTo, equals, getAddress, getLastContactNumber, getName, getNumber, hashCode, setAddress, setName, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Supplier

public Supplier(java.lang.String name,
                java.lang.String address)
Construct a supplier having the indicated name and address, and assign a unique number and an empty catalog of type HashMap to it. Number assignment is handled by the superclass Contact.

Parameters:
name - the name of the supplier.
address - the address of the supplier.
Throws:
a - runtime exception if either parameter is null.

Supplier

public Supplier(java.lang.String name,
                java.lang.String address,
                java.util.Map<Item,java.lang.Double> catalog)
Construct a supplier having the indicated name, address, and catalog, and assign a unique number to it.

Parameters:
name - the name of the supplier.
address - the address of the supplier.
catalog - the catalog of the supplier. A map containing an Item reference as key and its price as value.
Throws:
a - runtime exception if any of the parameters is null.
Method Detail

getCatalog

public java.util.Map<Item,java.lang.Double> getCatalog()
Determine the catalog this supplier.

Returns:
the catalog of this supplier.

setCatalog

public void setCatalog(java.util.Map<Item,java.lang.Double> catalog)
Set the catalog of this supplier to the passed one.



Java by Abstraction: A Client-View Approach