edu.cuny.cat.core
Class Transaction

java.lang.Object
  extended by edu.cuny.cat.core.Transaction
All Implemented Interfaces:
java.lang.Cloneable

public class Transaction
extends java.lang.Object
implements java.lang.Cloneable

This class records a match between an ask and a bid.

Version:
$Revision: 1.12 $
Author:
Jinzhong Niu

Field Summary
protected  Shout ask
          The offers that led to this transaction.
protected  Shout bid
          The offers that led to this transaction.
protected  java.lang.String id
          The identity allocated to this transaction.
protected  double price
          The price at which the good was sold for.
protected  Specialist specialist
           
 
Constructor Summary
Transaction(Shout ask, Shout bid, double price)
           
Transaction(java.lang.String id, Shout ask, Shout bid, double price)
           
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(Transaction anotherTrans)
          compares whether this transaction equals another one.
 Shout getAsk()
           
 Shout getBid()
           
 java.lang.String getId()
           
 double getPrice()
           
 int getQuantity()
           
 Specialist getSpecialist()
           
 void setAsk(Shout ask)
           
 void setBid(Shout bid)
           
 void setId(java.lang.String id)
           
 void setPrice(double price)
           
 void setSpecialist(Specialist specialist)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected java.lang.String id
The identity allocated to this transaction.


specialist

protected Specialist specialist

ask

protected Shout ask
The offers that led to this transaction.


bid

protected Shout bid
The offers that led to this transaction.


price

protected double price
The price at which the good was sold for.

Constructor Detail

Transaction

public Transaction(Shout ask,
                   Shout bid,
                   double price)

Transaction

public Transaction(java.lang.String id,
                   Shout ask,
                   Shout bid,
                   double price)
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(Transaction anotherTrans)
compares whether this transaction equals another one. If the two asks equals and the two bids equals, the two transactions are considered equal.

Parameters:
anotherTrans - the transaction to compare
Returns:
true if equal; false otherwise

getId

public java.lang.String getId()

getSpecialist

public Specialist getSpecialist()

getAsk

public Shout getAsk()

getBid

public Shout getBid()

getPrice

public double getPrice()

setAsk

public void setAsk(Shout ask)

setBid

public void setBid(Shout bid)

setId

public void setId(java.lang.String id)

setSpecialist

public void setSpecialist(Specialist specialist)

setPrice

public void setPrice(double price)

getQuantity

public int getQuantity()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object