Example #1
0
  public Integer compare(ValueStore<V> other) {
    if (other.moneySystem != moneySystem) {
      return null;
    }

    V val = moneySystem.subtract(getValue(), other.getValue());
    return (moneySystem.isValueNothing(val) ? 0 : (moneySystem.isValueDeficit(val) ? -1 : 1));
  }
Example #2
0
 public String toString(boolean longRepresentation) {
   return (longRepresentation
       ? moneySystem.getLongRepresentation(getValue())
       : moneySystem.getShortRepresentation(getValue()));
 }
Example #3
0
 public boolean getIsNothing() {
   return moneySystem.isValueNothing(getValue());
 }
Example #4
0
 public boolean equals(ValueStore<V> other) {
   return (other.moneySystem == moneySystem
       && moneySystem.isValueNothing(moneySystem.subtract(getValue(), other.getValue())));
 }
Example #5
0
 public boolean getIsDeficit() {
   return moneySystem.isValueDeficit(getValue());
 }
Example #6
0
 protected void loadData(Serializable data) {
   setValue(moneySystem.parseRepresentation((String) data));
 }
Example #7
0
 public Serializable getData() {
   return moneySystem.getShortRepresentation(getValue());
 }
Example #8
0
 public boolean subtractValue(V value) {
   return setValue(moneySystem.subtract(getValue(), value));
 }
Example #9
0
 public boolean addValue(V value) {
   return setValue(moneySystem.add(getValue(), value));
 }