|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPriceComparator
public class PriceComparator
A price comparator for trade orders.
Constructor Summary | |
---|---|
PriceComparator()
Constructs a price comparator that compares two orders in ascending order. |
|
PriceComparator(boolean asc)
Constructs a price comparator that compares two orders in ascending or descending order. |
Method Summary | |
---|---|
int |
compare(TradeOrder order1,
TradeOrder order2)
Compares two trade orders. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public PriceComparator()
boolean ascending
flag to true
.
public PriceComparator(boolean asc)
boolean ascending
flag to asc
.
asc
- if true, make an ascending comparator;
otherwise make a descending comparator.Method Detail |
---|
public int compare(TradeOrder order1, TradeOrder order2)
compare
in interface java.util.Comparator<TradeOrder>
order1
- the first orderorder2
- the second order
order1
is market and order2
is limit;order1
is limit and order2
is market;order1
and order2
are limit orders.
In the latter case, the difference returned is cents1 - cents2 or cents2 - cents1,
depending on whether this is an ascending or descending comparator
(ascending
is true
or false
).
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |