|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jasa.market.Order
public class Order
A class representing an order in an market. An order may be either a bid (offer to buy) or an ask (offer to sell).
Orders are mutable within this package for performance reasons, hence care should be taken not to rely on, e.g. shouts held in collections remaining constant.
![]() |
![]() |
![]() |
![]() |
Field Summary | |
---|---|
protected TradingAgent |
agent
The agent placing this order. |
protected Order |
child
The child of this order. |
protected boolean |
isBid
True if this order is a bid. |
protected double |
price
The price of this offer. |
protected int |
quantity
The volume of this order. |
protected SimulationTime |
timeStamp
The time that this order was placed. |
Constructor Summary | |
---|---|
Order()
|
|
Order(Order existing)
|
|
Order(TradingAgent agent)
|
|
Order(TradingAgent agent,
int quantity,
double price,
boolean isBid)
|
|
Order(TradingAgent agent,
int quantity,
double price,
boolean isBid,
SimulationTime timeStamp)
|
Method Summary | |
---|---|
java.lang.Object |
clone()
|
int |
compareTo(Order other)
|
void |
copyFrom(Order other)
|
TradingAgent |
getAgent()
|
Order |
getChild()
Get the child of this shout. |
double |
getPrice()
|
int |
getQuantity()
|
SimulationTime |
getTimeStamp()
|
boolean |
isAsk()
|
boolean |
isBid()
|
boolean |
isValid()
|
boolean |
matches(Order other)
Check whether two orders "cross"; that is, check whether this order could potentially be matched against the supplied order resulting in a transaction. |
static double |
maxPrice(Order s1,
Order s2)
|
static double |
minPrice(Order s1,
Order s2)
|
void |
setAgent(TradingAgent agent)
|
void |
setIsBid(boolean isBid)
|
void |
setPrice(double price)
|
void |
setQuantity(int quantity)
|
void |
setTimeStamp(SimulationTime timeStamp)
|
java.lang.String |
toPrettyString()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int quantity
protected double price
protected TradingAgent agent
protected boolean isBid
protected SimulationTime timeStamp
protected Order child
Constructor Detail |
---|
public Order(TradingAgent agent, int quantity, double price, boolean isBid)
public Order(TradingAgent agent, int quantity, double price, boolean isBid, SimulationTime timeStamp)
public Order(Order existing)
public Order(TradingAgent agent)
public Order()
Method Detail |
---|
public int getQuantity()
public double getPrice()
public TradingAgent getAgent()
public boolean isBid()
public boolean isAsk()
public boolean matches(Order other)
public int compareTo(Order other)
compareTo
in interface java.lang.Comparable<Order>
public boolean isValid()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toPrettyString()
public static double maxPrice(Order s1, Order s2)
public static double minPrice(Order s1, Order s2)
public Order getChild()
public void copyFrom(Order other)
public void setIsBid(boolean isBid)
public void setAgent(TradingAgent agent)
public void setPrice(double price)
public void setQuantity(int quantity)
public SimulationTime getTimeStamp()
public void setTimeStamp(SimulationTime timeStamp)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |