Holger's
Java API

com.antelmann.math
Enum MathOperator

java.lang.Object
  extended by java.lang.Enum<MathOperator>
      extended by com.antelmann.math.MathOperator
All Implemented Interfaces:
Serializable, Comparable<MathOperator>

public enum MathOperator
extends Enum<MathOperator>

basic math operators that allow to combine two numbers to produce a result

Since:
11.12.2010, 13:57:37
Author:
Holger Antelmann

Enum Constant Summary
ADD
           
DIVIDE
           
MULTIPLY
           
RAISE_TO_POWER
           
SUBTRACT
           
 
Method Summary
 BigDecimal asBigDecimal(Number n1, Number n2)
          calls asBigDecimal(Number, Number, int) with BigDecimal.ROUND_HALF_UP
 BigDecimal asBigDecimal(Number n1, Number n2, int roundingMode)
           
 double asDouble(double n1, double n2)
           
 double asDouble(Number n1, Number n2)
           
 float asFloat(float n1, float n2)
           
 float asFloat(Number n1, Number n2)
           
 int asInt(int n1, int n2)
           
 int asInt(Number n1, Number n2)
           
 long asLong(long n1, long n2)
           
 long asLong(Number n1, Number n2)
           
 Number asNumber(Number n1, Number n2)
           
 MathOperator fromString(String exp)
           
 String toString()
           
static MathOperator valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MathOperator[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ADD

public static final MathOperator ADD

SUBTRACT

public static final MathOperator SUBTRACT

MULTIPLY

public static final MathOperator MULTIPLY

DIVIDE

public static final MathOperator DIVIDE

RAISE_TO_POWER

public static final MathOperator RAISE_TO_POWER
Method Detail

values

public static MathOperator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MathOperator c : MathOperator.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MathOperator valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

fromString

public MathOperator fromString(String exp)

toString

public String toString()
Overrides:
toString in class Enum<MathOperator>

asNumber

public Number asNumber(Number n1,
                       Number n2)

asDouble

public double asDouble(Number n1,
                       Number n2)

asDouble

public double asDouble(double n1,
                       double n2)

asFloat

public float asFloat(Number n1,
                     Number n2)

asFloat

public float asFloat(float n1,
                     float n2)

asInt

public int asInt(Number n1,
                 Number n2)

asInt

public int asInt(int n1,
                 int n2)

asLong

public long asLong(Number n1,
                   Number n2)

asLong

public long asLong(long n1,
                   long n2)

asBigDecimal

public BigDecimal asBigDecimal(Number n1,
                               Number n2)
calls asBigDecimal(Number, Number, int) with BigDecimal.ROUND_HALF_UP


asBigDecimal

public BigDecimal asBigDecimal(Number n1,
                               Number n2,
                               int roundingMode)


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads