com.wewebu.expression.language
Class OwExprNumericValue

java.lang.Object
  extended by com.wewebu.expression.language.OwExprValue
      extended by com.wewebu.expression.language.OwExprNumericValue
All Implemented Interfaces:
OwExprScope, Comparable

public class OwExprNumericValue
extends OwExprValue
implements Comparable

The numeric value implementation.
Objects of this class represent floating point or integer numeric values. The implementation relays on the Number Java implementation.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Constructor Summary
OwExprNumericValue(double doubleNo_p)
          Constructor
OwExprNumericValue(int number_p)
          Constructor
OwExprNumericValue(Number number_p)
          Constructor
OwExprNumericValue(Number number_p, Class<?> javaType_p)
          Constructor
 
Method Summary
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprNumericValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprStringValue v1_p)
          Stage 2 binary operator visitor acceptance method
 OwExprValue accept(OwExprBinaryOperator binaryOperator_p, OwExprValue v2_p)
          Stage 1 binary operator visitor acceptance method
 OwExprValue accept(OwExprUnaryOperator unaryOperator_p)
          Unary operator visitor acceptance method
 OwExprNumericValue add(OwExprNumericValue numeric_p)
           
 int compareTo(Object o_p)
           
 OwExprValue div(OwExprNumericValue numeric_p)
           
 boolean equals(Object obj_p)
           
 int hashCode()
           
 OwExprValue mul(OwExprNumericValue numeric_p)
           
 OwExprNumericValue negate()
           
 OwExprValue reminder(OwExprNumericValue numeric_p)
           
 OwExprValue sub(OwExprNumericValue numeric_p)
           
 int toInt()
           
 Object toJavaObject(Class javaSuperType_p)
          Java class conversion method.
 String toString()
           
 
Methods inherited from class com.wewebu.expression.language.OwExprValue
accept, accept, accept, accept, at, fromJavaValue, fromJavaValue, function, getJavaType, getValuePropeties, hasProperty, length, property
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OwExprNumericValue

public OwExprNumericValue(Number number_p,
                          Class<?> javaType_p)
Constructor

Parameters:
number_p - the inner numeric value
javaType_p - original java type
Since:
1.3.0 and AWD 3.1.0

OwExprNumericValue

public OwExprNumericValue(Number number_p)
Constructor

Parameters:
number_p - the inner numeric value

OwExprNumericValue

public OwExprNumericValue(int number_p)
Constructor

Parameters:
number_p - the inner numeric value

OwExprNumericValue

public OwExprNumericValue(double doubleNo_p)
Constructor

Parameters:
doubleNo_p - the inner numeric value
Method Detail

accept

public final OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                                OwExprValue v2_p)
                         throws OwExprEvaluationException
Description copied from class: OwExprValue
Stage 1 binary operator visitor acceptance method

Overrides:
accept in class OwExprValue
Parameters:
binaryOperator_p - binary operator visitor
v2_p - right side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public final OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                                OwExprNumericValue v1_p)
                         throws OwExprEvaluationException
Description copied from class: OwExprValue
Stage 2 binary operator visitor acceptance method

Overrides:
accept in class OwExprValue
Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public final OwExprValue accept(OwExprBinaryOperator binaryOperator_p,
                                OwExprStringValue v1_p)
                         throws OwExprEvaluationException
Description copied from class: OwExprValue
Stage 2 binary operator visitor acceptance method

Overrides:
accept in class OwExprValue
Parameters:
binaryOperator_p - binary operator visitor
v1_p - lef side operator value
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

accept

public OwExprValue accept(OwExprUnaryOperator unaryOperator_p)
                   throws OwExprEvaluationException
Description copied from class: OwExprValue
Unary operator visitor acceptance method

Overrides:
accept in class OwExprValue
Parameters:
unaryOperator_p - binary operator visitor
Returns:
the operator visit processed OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

add

public OwExprNumericValue add(OwExprNumericValue numeric_p)

negate

public OwExprNumericValue negate()
Returns:
the arithmetic negation of this numeric value (egg. new OwExprNumericValue(1).negate().equals(new OwExprNumericValue(-1))

sub

public OwExprValue sub(OwExprNumericValue numeric_p)
Parameters:
numeric_p -
Returns:
a new OwExprNumericValue representing this numeric value minus the numeric value of the numeric_p parameter

mul

public OwExprValue mul(OwExprNumericValue numeric_p)
Parameters:
numeric_p -
Returns:
a new OwExprNumericValue representing this numeric multiplied by the numeric value of the numeric_p parameter

div

public OwExprValue div(OwExprNumericValue numeric_p)
                throws ArithmeticException
Parameters:
numeric_p -
Returns:
a new OwExprNumericValue representing this numeric divided by the numeric value of the numeric_p parameter
Throws:
ArithmeticException

reminder

public OwExprValue reminder(OwExprNumericValue numeric_p)
                     throws ArithmeticException
Parameters:
numeric_p -
Returns:
a new OwExprNumericValue representing reminder of the division of this numeric value and the numeric value of the numeric_p parameter
Throws:
ArithmeticException

equals

public boolean equals(Object obj_p)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toInt

public int toInt()

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Object o_p)
Specified by:
compareTo in interface Comparable

toJavaObject

public Object toJavaObject(Class javaSuperType_p)
                    throws OwExprEvaluationException
Description copied from class: OwExprValue
Java class conversion method.

Specified by:
toJavaObject in class OwExprValue
Parameters:
javaSuperType_p -
Returns:
this numeric value as an Integer if javaSuperType_p is different from Double.class and Double.TYPE
this numeric value as a Double otherwise
Throws:
OwExprEvaluationException


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.