|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object data.QuoteValue
A QuoteValue consists of two values: A bid
and an offer
.
QuoteValues usually represent prices. The bid is the price to be paid if someone wants to buy something from the Shop. The offer is the price paid when the Shop bought the product.
QuoteValues have two more attributes: the spread
and the mid
. While
the mid is the mean value of bid and offer, the spread is defined as bid - offer
.
Field Summary | |
protected Value |
m_vBid
The bid. |
protected Value |
m_vOffer
The offer. |
Constructor Summary | |
QuoteValue(Value vBid,
Value vOffer)
Create a new QuoteValue. |
Method Summary | |
Value |
add(Value v)
Add the given value to this one, and return the result. |
void |
addAccumulating(Value v)
If the given value is a QuoteValue, its bid and offer get added to this value's bid and offer, resp. |
Object |
clone()
Create and return a deep clone of the QuoteValue. |
int |
compareTo(Object o)
Compare this value to the given one. |
Value |
divide(Value v)
Divide this value by the given one, and return the result. |
void |
divideAccumulating(Value v)
If the given value is a QuoteValue, this value's bid and offer get divided by its bid and offer, resp. |
Value |
getBid()
Get the current bid of this QuoteValue. |
Value |
getMid()
Get the mid of this value. |
Value |
getOffer()
Get the current offer of this QuoteValue. |
Value |
getSpread()
Get the spread of this value. |
boolean |
isAddZero()
True, iff both bid and offer are zero elements with respect to addition. |
boolean |
isMulOne()
True, iff both bid and offer are one elements with respect to
multiplication. |
boolean |
isMulZero()
True, iff both bid and offer are zero elements with respect to
multiplication. |
Value |
multiply(double dl)
Multiply this value by the given 'scalar', and return the result. |
Value |
multiply(float fl)
Multiply this value by the given 'scalar', and return the result. |
Value |
multiply(int n)
Multiply this value by the given 'scalar', and return the result. |
Value |
multiply(long l)
Multiply this value by the given 'scalar', and return the result. |
Value |
multiply(Value v)
Multiply this value by the given one, and return the result. |
void |
multiplyAccumulating(double dl)
Both bid and offer get multiplied by the given 'scalar'. |
void |
multiplyAccumulating(float fl)
Both bid and offer get multiplied by the given 'scalar'. |
void |
multiplyAccumulating(int n)
Both bid and offer get multiplied by the given 'scalar'. |
void |
multiplyAccumulating(long l)
Both bid and offer get multiplied by the given 'scalar'. |
void |
multiplyAccumulating(Value v)
If the given value is a QuoteValue, its bid and offer get multiplied by this value's bid and offer, resp. |
Value |
subtract(Value v)
Subtract the given value from this one, and return the result. |
void |
subtractAccumulating(Value v)
If the given value is a QuoteValue, its bid and offer get subtracted from this value's bid and offer, resp. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Value m_vBid
protected Value m_vOffer
Constructor Detail |
public QuoteValue(Value vBid, Value vOffer)
vBid
- the bidvOffer
- the offer
IllegalArgumentException
- if (vBid.getClass() != vOffer.getClass())
.Method Detail |
public Value getBid()
public Value getOffer()
public Object clone()
Bid
and offer
are
cloned and the clones become bid and offer of the new Value.
clone
in interface Value
public void addAccumulating(Value v)
addAccumulating
in interface Value
v
- the value to be added.public void subtractAccumulating(Value v)
subtractAccumulating
in interface Value
v
- the value to be subtracted.public void multiplyAccumulating(Value v)
multiplyAccumulating
in interface Value
v
- the value to multiply by.public void multiplyAccumulating(double dl)
multiplyAccumulating
in interface Value
dl
- the 'scalar' to multiply by.public void multiplyAccumulating(float fl)
multiplyAccumulating
in interface Value
fl
- the 'scalar' to multiply by.public void multiplyAccumulating(long l)
multiplyAccumulating
in interface Value
l
- the 'scalar' to multiply by.public void multiplyAccumulating(int n)
multiplyAccumulating
in interface Value
n
- the 'scalar' to multiply by.public void divideAccumulating(Value v)
divideAccumulating
in interface Value
v
- the value to divide by.public Value add(Value v)
Value
add
in interface Value
v
- the value to be added.addAccumulating(data.Value)
public Value subtract(Value v)
Value
subtract
in interface Value
v
- the value to be subtracted.subtractAccumulating(data.Value)
public Value multiply(Value v)
Value
multiply
in interface Value
v
- the value by which to multiply.multiplyAccumulating(data.Value)
public Value multiply(double dl)
Value
multiply
in interface Value
dl
- the 'scalar' by which to multiply.multiplyAccumulating(double)
public Value multiply(float fl)
Value
multiply
in interface Value
fl
- the 'scalar' by which to multiply.multiplyAccumulating(float)
public Value multiply(long l)
Value
multiply
in interface Value
l
- the 'scalar' by which to multiply.multiplyAccumulating(long)
public Value multiply(int n)
Value
multiply
in interface Value
n
- the 'scalar' by which to multiply.multiplyAccumulating(int)
public Value divide(Value v)
Value
divide
in interface Value
v
- the value by which to divide.divideAccumulating(data.Value)
public Value getSpread()
bid
- offer
.
public Value getMid()
(bid
+ offer
) / 2
.
public int compareTo(Object o)
mids
.
compareTo
in interface Comparable
ClassCastException
- if the given object could not be cast into a QuoteValue.public boolean isAddZero()
bid
and offer
are zero elements with respect to addition.
isAddZero
in interface Value
v
:
(v.getClass() == this.getClass()) -> ((v.add (this).equals (v)) && (this.add (v).equals (v)))
.public boolean isMulZero()
bid
and offer
are zero elements with respect to
multiplication.
isMulZero
in interface Value
v
:
(v.getClass() == this.getClass()) -> ((v.multiply (this).equals (this)) && (this.multiply (v).equals (this)))
.public boolean isMulOne()
bid
and offer
are one elements with respect to
multiplication.
isMulOne
in interface Value
v
:
(v.getClass() == this.getClass()) -> ((v.multiply (this).equals (v)) && (this.multiply (v).equals (v)))
.
|
SalesPoint Framework v3.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |