Package org.apache.fop.fo.expr
Class NumericOp
java.lang.Object
org.apache.fop.fo.expr.NumericOp
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.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NumericReturn the absolute value of a Numeric.static Numericabs2(Numeric op, PercentBaseContext context) Return the absolute value of a Numeric.static NumericAdd the two operands and return a new Numeric representing the result.static Numericaddition2(Numeric op1, Numeric op2, PercentBaseContext context) Add the two operands with a percentage context and return a new Numeric representing the result.static NumericDivide the second operand into the first and return a new Numeric representing the result.static Numericdivide2(Numeric op1, Numeric op2, PercentBaseContext context) Divide the two operands with a percentage context and return a new Numeric representing the result.static NumericReturn the larger of the two Numerics.static Numericmax2(Numeric op1, Numeric op2, PercentBaseContext context) Return the larger of the two Numerics.static NumericReturn the smaller of two Numerics.static Numericmin2(Numeric op1, Numeric op2, PercentBaseContext context) Return the smaller of the two Numerics.static NumericReturn the remainder of a division of the two operand Numeric.static Numericmodulo2(Numeric op1, Numeric op2, PercentBaseContext context) Return the remainder of a division of the two operand Numeric.static NumericMultiply the two operands and return a new Numeric representing the result.static Numericmultiply2(Numeric op1, Numeric op2, PercentBaseContext context) Multiply the two operands with a percentage context and return a new Numeric representing the result.static NumericReturn the negation of a Numeric.static Numericnegate2(Numeric op, PercentBaseContext context) Return the negation of a Numeric.static Numericsubtraction(Numeric op1, Numeric op2) Add the second operand from the first and return a new Numeric representing the result.static Numericsubtraction2(Numeric op1, Numeric op2, PercentBaseContext context) Subtract the two operands with a percentage context and return a new Numeric representing the result.
-
Method Details
-
addition
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 Add the two operands with a percentage context and return a new Numeric representing the result.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
subtraction
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 Subtract the two operands with a percentage context and return a new Numeric representing the result.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
multiply
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 Multiply the two operands with a percentage context and return a new Numeric representing the result.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
divide
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 Divide the two operands with a percentage context and return a new Numeric representing the result.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
modulo
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- if a property exception occurs
-
modulo2
public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException Return the remainder of a division of the two operand Numeric.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
abs
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- if a property exception occurs
-
abs2
Return the absolute value of a Numeric.- Parameters:
op- the operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
negate
Return the negation of a Numeric.- Parameters:
op- the operand.- Returns:
- a new Numeric object representing the negation of the operand.
- Throws:
PropertyException- if a property exception occurs
-
negate2
Return the negation of a Numeric.- Parameters:
op- the operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
max
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 Return the larger of the two Numerics.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-
min
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 Return the smaller of the two Numerics.- Parameters:
op1- The first operand.op2- The second operand.context- a percent base context- Returns:
- A Numeric representing the result.
- Throws:
PropertyException- If the dimension of the operand is different from the dimension of this Numeric.
-