fop 1.0

org.apache.fop.fo.expr
Class NumericOp

java.lang.Object
  extended by org.apache.fop.fo.expr.NumericOp

public class NumericOp
extends java.lang.Object

This class contains static methods to evaluate operations on Numeric operands. If the operands are absolute numerics the result is computed rigth away and a new absolute numeric is return. If one of the operands are relative a n operation node is created with the operation and the operands. The evaluation of the operation can then occur when getNumericValue() is called.


Constructor Summary
NumericOp()
           
 
Method Summary
static Numeric abs(Numeric op)
          Return the absolute value of a Numeric.
static Numeric abs2(Numeric op, PercentBaseContext context)
           
static Numeric addition(Numeric op1, Numeric op2)
          Add the two operands and return a new Numeric representing the result.
static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context)
           
static Numeric divide(Numeric op1, Numeric op2)
          Divide the second operand into the first and return a new Numeric representing the result.
static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context)
           
static Numeric max(Numeric op1, Numeric op2)
          Return the larger of the two Numerics.
static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context)
           
static Numeric min(Numeric op1, Numeric op2)
          Return the smaller of two Numerics.
static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context)
           
static Numeric modulo(Numeric op1, Numeric op2)
          Return the remainder of a division of the two operand Numeric.
static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context)
           
static Numeric multiply(Numeric op1, Numeric op2)
          Multiply the two operands and return a new Numeric representing the result.
static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context)
           
static Numeric negate(Numeric op)
          Return the negation of a Numeric.
static Numeric negate2(Numeric op, PercentBaseContext context)
           
static Numeric subtraction(Numeric op1, Numeric op2)
          Add the second operand from the first and return a new Numeric representing the result.
static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumericOp

public NumericOp()
Method Detail

addition

public static Numeric addition(Numeric op1,
                               Numeric op2)
                        throws PropertyException
Add the two operands and return a new Numeric representing the result.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
A Numeric representing the result.
Throws:
PropertyException - If the dimension of the operand is different from the dimension of this Numeric.

addition2

public static Numeric addition2(Numeric op1,
                                Numeric op2,
                                PercentBaseContext context)
                         throws PropertyException
Throws:
PropertyException

subtraction

public static Numeric subtraction(Numeric op1,
                                  Numeric op2)
                           throws PropertyException
Add the second operand from the first and return a new Numeric representing the result.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
A Numeric representing the result.
Throws:
PropertyException - If the dimension of the operand is different from the dimension of this Numeric.

subtraction2

public static Numeric subtraction2(Numeric op1,
                                   Numeric op2,
                                   PercentBaseContext context)
                            throws PropertyException
Throws:
PropertyException

multiply

public static Numeric multiply(Numeric op1,
                               Numeric op2)
                        throws PropertyException
Multiply the two operands and return a new Numeric representing the result.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
A Numeric representing the result.
Throws:
PropertyException - If the dimension of the operand is different from the dimension of this Numeric.

multiply2

public static Numeric multiply2(Numeric op1,
                                Numeric op2,
                                PercentBaseContext context)
                         throws PropertyException
Throws:
PropertyException

divide

public static Numeric divide(Numeric op1,
                             Numeric op2)
                      throws PropertyException
Divide the second operand into the first and return a new Numeric representing the result.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
A Numeric representing the result.
Throws:
PropertyException - If the dimension of the operand is different from the dimension of this Numeric.

divide2

public static Numeric divide2(Numeric op1,
                              Numeric op2,
                              PercentBaseContext context)
                       throws PropertyException
Throws:
PropertyException

modulo

public static Numeric modulo(Numeric op1,
                             Numeric op2)
                      throws PropertyException
Return the remainder of a division of the two operand Numeric.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
A new Numeric object representing the absolute value.
Throws:
PropertyException

modulo2

public static Numeric modulo2(Numeric op1,
                              Numeric op2,
                              PercentBaseContext context)
                       throws PropertyException
Throws:
PropertyException

abs

public static Numeric abs(Numeric op)
                   throws PropertyException
Return the absolute value of a Numeric.

Parameters:
op - the operand.
Returns:
a new Numeric object representing the absolute value of the operand.
Throws:
PropertyException

abs2

public static Numeric abs2(Numeric op,
                           PercentBaseContext context)
                    throws PropertyException
Throws:
PropertyException

negate

public static Numeric negate(Numeric op)
                      throws PropertyException
Return the negation of a Numeric.

Parameters:
op - the operand.
Returns:
a new Numeric object representing the negation of the operand.
Throws:
PropertyException

negate2

public static Numeric negate2(Numeric op,
                              PercentBaseContext context)
                       throws PropertyException
Throws:
PropertyException

max

public static Numeric max(Numeric op1,
                          Numeric op2)
                   throws PropertyException
Return the larger of the two Numerics.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
a Numeric which is the maximum of the two operands.
Throws:
PropertyException - if the dimensions or value types of the operands are different.

max2

public static Numeric max2(Numeric op1,
                           Numeric op2,
                           PercentBaseContext context)
                    throws PropertyException
Throws:
PropertyException

min

public static Numeric min(Numeric op1,
                          Numeric op2)
                   throws PropertyException
Return the smaller of two Numerics.

Parameters:
op1 - The first operand.
op2 - The second operand.
Returns:
a Numeric which is the minimum of the two operands.
Throws:
PropertyException - if the dimensions or value types of the operands are different.

min2

public static Numeric min2(Numeric op1,
                           Numeric op2,
                           PercentBaseContext context)
                    throws PropertyException
Throws:
PropertyException

fop 1.0

Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.