Skip to content

Commit

Permalink
Coin: more aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehearn committed Sep 2, 2015
1 parent 629e5d8 commit 48b4df7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/src/main/java/org/bitcoinj/core/Coin.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,30 @@ public Coin multiply(final long factor) {
return new Coin(LongMath.checkedMultiply(this.value, factor));
}

/** Alias for multiply */
public Coin times(final long factor) {
return multiply(factor);
}

/** Alias for multiply */
public Coin times(final int factor) {
return multiply(factor);
}

public Coin divide(final long divisor) {
return new Coin(this.value / divisor);
}

/** Alias for divide */
public Coin div(final long divisor) {
return divide(divisor);
}

/** Alias for divide */
public Coin div(final int divisor) {
return divide(divisor);
}

public Coin[] divideAndRemainder(final long divisor) {
return new Coin[] { new Coin(this.value / divisor), new Coin(this.value % divisor) };
}
Expand Down

0 comments on commit 48b4df7

Please sign in to comment.