com.rubecula.jquantity
Interface Arithmutable

All Superinterfaces:
java.lang.Cloneable, Mutable
All Known Implementing Classes:
MutableNumber

public interface Arithmutable
extends Mutable

This interface defines various arithmetical mutating methods.

Version:
$Revision: 1.3 $
Author:
Robin Hillyard

Method Summary
 void add(BaseNumber addend)
          MUTATING Instance method to add another Arithmetical into this object.
 void forcePositive()
          MUTATING Instance method to force the value to be positive, i.e.
 void multiply(BaseNumber multiplicand)
          MUTATING Instance method to multiply another Arithmetical into this object.
 void negate()
          MUTATING Instance method to negate this.
 void raiseToPower(int power)
          MUTATING Instance method to raise this to power x.
 void scale(long factor)
          MUTATING Instance method to multiply this by a scale factor.
 

Method Detail

add

public void add(BaseNumber addend)
         throws InvalidOperandException
MUTATING Instance method to add another Arithmetical into this object.

Parameters:
addend - the number to add to this.
Throws:
InvalidOperandException - operands are not compatible for the add operation.

forcePositive

public void forcePositive()
MUTATING Instance method to force the value to be positive, i.e. this = abs (this).


multiply

public void multiply(BaseNumber multiplicand)
              throws InvalidOperandException
MUTATING Instance method to multiply another Arithmetical into this object.

Parameters:
multiplicand - the number by which this is to be multiplied.
Throws:
InvalidOperandException - operands are not compatible for the multiply operation.

negate

public void negate()
MUTATING Instance method to negate this.


raiseToPower

public void raiseToPower(int power)
MUTATING Instance method to raise this to power x.

Parameters:
power - the number of times this should be multiplied by itself.

scale

public void scale(long factor)
MUTATING Instance method to multiply this by a scale factor. Note that under this operation, the scaling (multiplication) is always directly on the value in this regardless of type. So for example, if this is an instance of Value of type Log, then the effect of a scale by rwo will be to square the effective value.

Parameters:
factor - the scale factor.