jamel.markets
Class GoodsOffer

java.lang.Object
  extended by jamel.markets.AbstractOffer
      extended by jamel.markets.GoodsOffer
All Implemented Interfaces:
java.lang.Comparable<AbstractOffer>

public class GoodsOffer
extends AbstractOffer

Represents an offer on a goods market.

Last update: 8-Dec-2010.


Constructor Summary
GoodsOffer(Provider provider, int volume, double price)
          Creates a new offer.
 
Method Summary
 int compareTo(AbstractOffer otherOffer)
          Implements the Comparable interface so that offers can easily be sorted.
 double getPrice()
          Returns the unit price.
 Provider getProvider()
          Returns the author of the offer.
 java.lang.String toString()
          Returns a string representation of the offer.
 
Methods inherited from class jamel.markets.AbstractOffer
clear, getOfferer, getVolume, subtract
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GoodsOffer

public GoodsOffer(Provider provider,
                  int volume,
                  double price)
Creates a new offer.

Parameters:
provider - the author of the offer.
volume - the offered volume.
price - the unit price of the offer.
Method Detail

compareTo

public int compareTo(AbstractOffer otherOffer)
Implements the Comparable interface so that offers can easily be sorted.

Parameters:
otherOffer - the offer to compare against.
Returns:
1 if the price of the other offer is less than this, 0 if both have the same price and -1 this price is less than the others.

getPrice

public double getPrice()
Returns the unit price.

Overrides:
getPrice in class AbstractOffer
Returns:
the unit price.

getProvider

public Provider getProvider()
Returns the author of the offer.

Returns:
the provider author of the offer.

toString

public java.lang.String toString()
Returns a string representation of the offer.

Overrides:
toString in class java.lang.Object
Returns:
a string.