net.commerce.zocalo.currency
Class CouponBank
java.lang.Object
net.commerce.zocalo.currency.CouponBank
- Direct Known Subclasses:
- UnaryCouponBank
public class CouponBank
- extends java.lang.Object
CouponBank is an issuer of Coupons for a particular claim. It issues a
non-forgeable currency, and is the only holder of the token that allows
creation of new Coupons. Anyone who has access to the bank can
instruct the bank to issue coupon pairs or individual coupons. The pairs
must be paid for, so that interface doesn't need to be closely held, but
the ability to create unpaired coupons must be treated as a closely held
capability.
Method Summary |
Quantity |
balance()
|
Quantity |
getSetsMinted()
|
Quantity |
getSetsRedeemed()
|
boolean |
identify(CouponBank bank)
|
protected void |
increment(java.util.Map<Position,Quantity> redemptions,
Position position,
Quantity balance)
|
protected void |
incrementSetsMinted(Quantity amount)
|
protected void |
incrementSetsRedeemed(Quantity amount)
|
Coupons |
issueUnpairedCoupons(Quantity quantity,
Position pos)
|
static CouponBank |
makeBank(Claim claim,
Funds empty)
|
Coupons[] |
printNewCouponSets(Quantity amount,
Funds funds,
Quantity couponCost)
|
Quantity |
redeem(Position pos,
java.util.Set users,
Market market,
MarketMaker maker)
|
Accounts |
settle(Quantity quantity,
java.util.Map couponsMap,
Quantity couponCost)
couponsMap should contain QUANTITY of each coupon in this claim. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
makeBank
public static CouponBank makeBank(Claim claim,
Funds empty)
incrementSetsMinted
protected void incrementSetsMinted(Quantity amount)
incrementSetsRedeemed
protected void incrementSetsRedeemed(Quantity amount)
getSetsMinted
public Quantity getSetsMinted()
getSetsRedeemed
public Quantity getSetsRedeemed()
balance
public Quantity balance()
printNewCouponSets
public Coupons[] printNewCouponSets(Quantity amount,
Funds funds,
Quantity couponCost)
settle
public Accounts settle(Quantity quantity,
java.util.Map couponsMap,
Quantity couponCost)
- couponsMap should contain QUANTITY of each coupon in this claim. If it
contains fewer, the owner will only get credit for the full sets. Any odd
coupons will be returned.
issueUnpairedCoupons
public Coupons issueUnpairedCoupons(Quantity quantity,
Position pos)
redeem
public Quantity redeem(Position pos,
java.util.Set users,
Market market,
MarketMaker maker)
increment
protected void increment(java.util.Map<Position,Quantity> redemptions,
Position position,
Quantity balance)
identify
public boolean identify(CouponBank bank)