ch.javasoft.math
Class AbstractNumberOps<N extends Number>

java.lang.Object
  extended by ch.javasoft.math.AbstractNumberOps<N>
All Implemented Interfaces:
NumberOperations<N>, Comparator<N>
Direct Known Subclasses:
BigDecimalOperations, BigFractionOperations, BigIntegerOperations, DoubleOperations, IntegerOperations, LongOperations

public abstract class AbstractNumberOps<N extends Number>
extends Object
implements NumberOperations<N>


Constructor Summary
AbstractNumberOps()
           
 
Method Summary
 N abs(N number)
          Returns the absolute value of the given number, i.e.
 N invert(N number)
          Returns the inverted value, i.e.
 boolean isNegative(N number)
          Returns true if this value negative, i.e.
 boolean isNonNegative(N number)
          Returns true if this value not negative, i.e.
 boolean isNonPositive(N number)
          Returns true if this value not positive, i.e.
 boolean isNonZero(N number)
          Returns true if this value is numerically unequal to zero, i.e.
 boolean isOne(N number)
          Returns true if this value is numerically equal to one, i.e.
 boolean isPositive(N number)
          Returns true if this value positive, i.e.
 boolean isZero(N number)
          Returns true if this value is numerically equal to zero, i.e.
 N max(N... vals)
          Returns the largest value of the given numbers, i.e.
 N max(N valA, N valB)
          Returns the larger value of the two numbers, i.e.
 N min(N... vals)
          Returns the smallest value of the given numbers, i.e.
 N min(N valA, N valB)
          Returns the smaller value of the two numbers, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ch.javasoft.math.NumberOperations
add, byteLength, divide, fromByteArray, multiply, negate, newArray, newArray, numberClass, one, pow, readFrom, reduce, reduceVector, signum, subtract, toByteArray, valueOf, valueOf, valueOf, valueOf, writeTo, zero
 
Methods inherited from interface java.util.Comparator
compare, equals
 

Constructor Detail

AbstractNumberOps

public AbstractNumberOps()
Method Detail

abs

public N abs(N number)
Description copied from interface: NumberOperations
Returns the absolute value of the given number, i.e. a non-negative value abs(number)

Specified by:
abs in interface NumberOperations<N extends Number>

invert

public N invert(N number)
Description copied from interface: NumberOperations
Returns the inverted value, i.e. 1 / number

Specified by:
invert in interface NumberOperations<N extends Number>

isNegative

public boolean isNegative(N number)
Description copied from interface: NumberOperations
Returns true if this value negative, i.e. number < 0

Specified by:
isNegative in interface NumberOperations<N extends Number>

isNonZero

public boolean isNonZero(N number)
Description copied from interface: NumberOperations
Returns true if this value is numerically unequal to zero, i.e. number != 0

Specified by:
isNonZero in interface NumberOperations<N extends Number>

isOne

public boolean isOne(N number)
Description copied from interface: NumberOperations
Returns true if this value is numerically equal to one, i.e. number == 1

Specified by:
isOne in interface NumberOperations<N extends Number>

isPositive

public boolean isPositive(N number)
Description copied from interface: NumberOperations
Returns true if this value positive, i.e. number > 0

Specified by:
isPositive in interface NumberOperations<N extends Number>

isZero

public boolean isZero(N number)
Description copied from interface: NumberOperations
Returns true if this value is numerically equal to zero, i.e. number == 0

Specified by:
isZero in interface NumberOperations<N extends Number>

isNonNegative

public boolean isNonNegative(N number)
Description copied from interface: NumberOperations
Returns true if this value not negative, i.e. number >= 0

Specified by:
isNonNegative in interface NumberOperations<N extends Number>

isNonPositive

public boolean isNonPositive(N number)
Description copied from interface: NumberOperations
Returns true if this value not positive, i.e. number <= 0

Specified by:
isNonPositive in interface NumberOperations<N extends Number>

max

public N max(N valA,
             N valB)
Description copied from interface: NumberOperations
Returns the larger value of the two numbers, i.e. max(valA, valB)

Specified by:
max in interface NumberOperations<N extends Number>

max

public N max(N... vals)
Description copied from interface: NumberOperations
Returns the largest value of the given numbers, i.e. max(vals)

Specified by:
max in interface NumberOperations<N extends Number>

min

public N min(N valA,
             N valB)
Description copied from interface: NumberOperations
Returns the smaller value of the two numbers, i.e. min(valA, valB)

Specified by:
min in interface NumberOperations<N extends Number>

min

public N min(N... vals)
Description copied from interface: NumberOperations
Returns the smallest value of the given numbers, i.e. min(vals)

Specified by:
min in interface NumberOperations<N extends Number>