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.

Since:
V_0_2
Version:
$Revision: 1.7 $
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.
 
Methods inherited from interface com.rubecula.jquantity.Mutable
isMutable, setConstant
 

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 stored value in this regardless of values of other fields. Furthermore, only the stored value will change, no other field values, such as factoring schemes, etc.

Parameters:
factor - the scale factor.