org.qtitools.qti.node.expression.operator
Enum RoundingMode

java.lang.Object
  extended by java.lang.Enum<RoundingMode>
      extended by org.qtitools.qti.node.expression.operator.RoundingMode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<RoundingMode>

public enum RoundingMode
extends java.lang.Enum<RoundingMode>

Enumeration for equalRounded expression.

Author:
Jiri Kajaba
See Also:
EqualRounded

Enum Constant Summary
DECIMAL_PLACES
          Number is rounded to A given number of decimal places.
SIGNIFICANT_FIGURES
          Number is rounded to A given number of significant figures.
 
Field Summary
static java.lang.String CLASS_TAG
          Name of this class in xml schema.
 
Method Summary
 boolean isEqual(double firstNumber, double secondNumber, int figures)
          Returns true if given two numbers are equal after rounding; false otherwise.
static RoundingMode parseRoundingMode(java.lang.String roundingMode)
          Parses string representation of RoundingMode.
protected abstract  java.math.BigDecimal round(double number, int figures)
          Rounds given number for given number of figures.
 java.lang.String toString()
           
abstract  ValidationResult validateFigures(Attribute attribute, int figures)
          Validates figures attribute.
static RoundingMode valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static RoundingMode[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SIGNIFICANT_FIGURES

public static final RoundingMode SIGNIFICANT_FIGURES
Number is rounded to A given number of significant figures.


DECIMAL_PLACES

public static final RoundingMode DECIMAL_PLACES
Number is rounded to A given number of decimal places.

Field Detail

CLASS_TAG

public static final java.lang.String CLASS_TAG
Name of this class in xml schema.

See Also:
Constant Field Values
Method Detail

values

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

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

valueOf

public static RoundingMode valueOf(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

validateFigures

public abstract ValidationResult validateFigures(Attribute attribute,
                                                 int figures)
Validates figures attribute.

Parameters:
attribute - attribute to be validated
figures - attribute's value to be validated
Returns:
result of validation

round

protected abstract java.math.BigDecimal round(double number,
                                              int figures)
Rounds given number for given number of figures.

Parameters:
number - number
figures - number of figures
Returns:
rounded number

isEqual

public boolean isEqual(double firstNumber,
                       double secondNumber,
                       int figures)
Returns true if given two numbers are equal after rounding; false otherwise.

Parameters:
firstNumber - first number to compare
secondNumber - second number to compare
figures - rounding figures
Returns:
true if given two numbers are equal after rounding; false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Enum<RoundingMode>

parseRoundingMode

public static RoundingMode parseRoundingMode(java.lang.String roundingMode)
Parses string representation of RoundingMode.

Parameters:
roundingMode - string representation of RoundingMode
Returns:
parsed RoundingMode


Copyright © 2009. All Rights Reserved.