net.commerce.zocalo.currency
Class RangedQuantity

java.lang.Object
  extended by net.commerce.zocalo.currency.Quantity
      extended by net.commerce.zocalo.currency.RangedQuantity
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
Price, Probability

public abstract class RangedQuantity
extends Quantity

RangedQuantities are BigDecimals whose values range from zero to some maximum value. They're useful for limited prices and for probabilities.


Field Summary
protected  Quantity maxValue
           
 
Fields inherited from class net.commerce.zocalo.currency.Quantity
EPSILON, NINE_DIGITS, ONE, Q100, quant, ROUNDING_CONTEXT, ZERO
 
Constructor Summary
RangedQuantity(java.math.BigDecimal d, java.math.BigDecimal maximum)
           
RangedQuantity(java.math.BigDecimal quantity, Quantity max)
           
RangedQuantity(java.math.BigDecimal q, java.lang.String maximum)
           
RangedQuantity(double quantity, Quantity max)
           
RangedQuantity(Quantity q, java.math.BigDecimal maximum)
           
RangedQuantity(Quantity quantity, Quantity newRange)
           
RangedQuantity(java.lang.String q, java.math.BigDecimal maximum)
           
RangedQuantity(java.lang.String q, Quantity maximum)
           
RangedQuantity(java.lang.String q, java.lang.String maximum)
           
 
Method Summary
 Probability asProbability()
           
 Quantity asQuantity()
           
 boolean eq(Quantity q)
           
 boolean equals(java.lang.Object o)
           
 Quantity getMaxValue()
           
 int hashCode()
           
abstract  RangedQuantity inverted()
           
abstract  RangedQuantity newValue(java.math.BigDecimal quantity)
           
abstract  RangedQuantity newValue(Quantity quantity)
           
abstract  RangedQuantity round(java.math.MathContext c)
           
 void setMaxValue(Quantity maxValue)
          Deprecated.  
 
Methods inherited from class net.commerce.zocalo.currency.Quantity
abs, absLog, approaches, asValue, compareTo, compareTo, div, div, exp, floor, getId, getQuant, isNegative, isNegligible, isNonNegative, isPositive, isZero, max, min, minus, movePointLeft, negate, newScale, plus, printAsDetailedQuantity, printAsDollars, printAsIntegerQuantity, printAsQuantity, printAsScore, remainder, round, roundFloor, scale, setId, setQuant, simplify, times, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

maxValue

protected Quantity maxValue
Constructor Detail

RangedQuantity

public RangedQuantity(java.math.BigDecimal q,
                      java.lang.String maximum)

RangedQuantity

public RangedQuantity(java.lang.String q,
                      java.lang.String maximum)

RangedQuantity

public RangedQuantity(Quantity q,
                      java.math.BigDecimal maximum)

RangedQuantity

public RangedQuantity(java.math.BigDecimal quantity,
                      Quantity max)

RangedQuantity

public RangedQuantity(double quantity,
                      Quantity max)

RangedQuantity

public RangedQuantity(java.lang.String q,
                      java.math.BigDecimal maximum)

RangedQuantity

public RangedQuantity(java.lang.String q,
                      Quantity maximum)

RangedQuantity

public RangedQuantity(java.math.BigDecimal d,
                      java.math.BigDecimal maximum)

RangedQuantity

public RangedQuantity(Quantity quantity,
                      Quantity newRange)
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class Quantity

hashCode

public int hashCode()
Overrides:
hashCode in class Quantity

getMaxValue

public Quantity getMaxValue()

setMaxValue

public void setMaxValue(Quantity maxValue)
Deprecated. 


asQuantity

public Quantity asQuantity()
Overrides:
asQuantity in class Quantity

eq

public boolean eq(Quantity q)
Overrides:
eq in class Quantity

round

public abstract RangedQuantity round(java.math.MathContext c)
Overrides:
round in class Quantity

newValue

public abstract RangedQuantity newValue(Quantity quantity)

newValue

public abstract RangedQuantity newValue(java.math.BigDecimal quantity)

inverted

public abstract RangedQuantity inverted()

asProbability

public Probability asProbability()