jamel.markets
Class AbstractOffer

java.lang.Object
  extended by jamel.markets.AbstractOffer
All Implemented Interfaces:
java.lang.Comparable<AbstractOffer>
Direct Known Subclasses:
GoodsOffer, JobOffer

public abstract class AbstractOffer
extends java.lang.Object
implements java.lang.Comparable<AbstractOffer>

A base class for offers on markets.

Encapsulates a volume offered and a unit price.

Last update: 8-Dec-2010.


Field Summary
private  Offerer author
          The agent author of the offer.
private  double price
          The unit price.
private  int volume
          The offered volume.
 
Constructor Summary
protected AbstractOffer(Offerer offerer, int volume, double price)
          Creates a new offer.
 
Method Summary
 void clear()
           
protected  Offerer getOfferer()
          Returns the agent author of the offer.
protected  double getPrice()
          Returns the unit price.
 int getVolume()
          Returns the offered volume.
 void subtract(double volume)
          Subtract a volume to the offered volume.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

author

private Offerer author
The agent author of the offer.


price

private final double price
The unit price.


volume

private int volume
The offered volume.

Constructor Detail

AbstractOffer

protected AbstractOffer(Offerer offerer,
                        int volume,
                        double price)
Creates a new offer.

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

clear

public void clear()

getOfferer

protected Offerer getOfferer()
Returns the agent author of the offer.

Returns:
the offerer.

getPrice

protected double getPrice()
Returns the unit price.

Returns:
a double that represents the unit price.

getVolume

public int getVolume()
Returns the offered volume.

Returns:
a double that represents the volume.

subtract

public void subtract(double volume)
Subtract a volume to the offered volume.

Parameters:
volume - the volume to subtract.