Changeset 1888

Show
Ignore:
Timestamp:
05/27/09 09:29:05 (3 years ago)
Author:
eitan
Message:

committed two convenience methods suggested by mike on mailing list to atomic types Money and Percent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • jmatter-complet/trunk/jmatter/src/com/u2d/type/atom/Money.java

    r1658 r1888  
    2323   { 
    2424      setValue(amt, currencyCode); 
     25   } 
     26 
     27   public Money(BigDecimal amt, Currency currency) 
     28   { 
     29      setValue(amt, currency); 
    2530   } 
    2631 
  • jmatter-complet/trunk/jmatter/src/com/u2d/type/atom/Percent.java

    r981 r1888  
    1313import java.text.*; 
    1414import java.util.List; 
     15import java.math.BigDecimal; 
    1516 
    1617/** 
     
    5455      return _value * amt.doubleValue(); 
    5556   } 
    56     
     57 
     58   public Money applyTo(Money value) 
     59   { 
     60      return new Money(new BigDecimal(_value).multiply(value.amount()), value.currency()); 
     61   } 
     62 
    5763   public Title title() 
    5864   {