org.apache.fop.fo.expr

Class RelativeNumericProperty

Implemented Interfaces:
Length, Numeric

public class RelativeNumericProperty
extends Property
implements Numeric, Length

This class represent a node in a property expression tree. It is created when an operation involve relative expression and is used to delay evaluation of the operation until the time where getNumericValue() or getValue() is called.

Field Summary

static int
ABS
static int
ADDITION
static int
DIVIDE
static int
MAX
static int
MIN
static int
MODULO
static int
MULTIPLY
static int
NEGATE
static int
SUBTRACTION

Fields inherited from class org.apache.fop.fo.properties.Property

log

Constructor Summary

RelativeNumericProperty(int operation, Numeric op)
Constructor for a one argument operation.
RelativeNumericProperty(int operation, Numeric op1, Numeric op2)
Constructor for a two argument operation.

Method Summary

int
getDimension()
Return the dimension of the expression
Length
getLength()
Cast this numeric as a Length.
Numeric
getNumeric()
This method expects to be overridden by subclasses
double
getNumericValue()
Return the resolved (calculated) value of the expression.
double
getNumericValue(PercentBaseContext context)
int
getValue()
int
getValue(PercentBaseContext context)
boolean
isAbsolute()
Return false since an expression is only created when there is relative numerics involved.
String
toString()
Return a string represention of the expression.

Methods inherited from class org.apache.fop.fo.properties.Property

getCharacter, getColor, getCondLength, getEnum, getKeep, getLength, getLengthPair, getLengthRange, getList, getNCname, getNumber, getNumeric, getObject, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue, toString

Field Details

ABS

public static final int ABS
Field Value:
7

ADDITION

public static final int ADDITION
Field Value:
1

DIVIDE

public static final int DIVIDE
Field Value:
4

MAX

public static final int MAX
Field Value:
8

MIN

public static final int MIN
Field Value:
9

MODULO

public static final int MODULO
Field Value:
5

MULTIPLY

public static final int MULTIPLY
Field Value:
3

NEGATE

public static final int NEGATE
Field Value:
6

SUBTRACTION

public static final int SUBTRACTION
Field Value:
2

Constructor Details

RelativeNumericProperty

public RelativeNumericProperty(int operation,
                               Numeric op)
Constructor for a one argument operation.
Parameters:
operation - the operation opcode: NEGATE, ABS
op - the operand.

RelativeNumericProperty

public RelativeNumericProperty(int operation,
                               Numeric op1,
                               Numeric op2)
Constructor for a two argument operation.
Parameters:
operation - the operation opcode: ADDITION, SUBTRACTION, ...
op1 - the first operand.
op2 - the second operand

Method Details

getDimension

public int getDimension()
Return the dimension of the expression
Specified by:
getDimension in interface Numeric

getLength

public Length getLength()
Cast this numeric as a Length.
Overrides:
getLength in interface Property

getNumeric

public Numeric getNumeric()
This method expects to be overridden by subclasses
Overrides:
getNumeric in interface Property
Returns:
Numeric property value

getNumericValue

public double getNumericValue()
            throws PropertyException
Return the resolved (calculated) value of the expression.
Specified by:
getNumericValue in interface Numeric

getNumericValue

public double getNumericValue(PercentBaseContext context)
            throws PropertyException
Specified by:
getNumericValue in interface Numeric

getValue

public int getValue()
Specified by:
getValue in interface Numeric
getValue in interface Length

getValue

public int getValue(PercentBaseContext context)
Specified by:
getValue in interface Numeric
getValue in interface Length

isAbsolute

public boolean isAbsolute()
Return false since an expression is only created when there is relative numerics involved.
Specified by:
isAbsolute in interface Numeric

toString

public String toString()
Return a string represention of the expression. Only used for debugging.
Overrides:
toString in interface Property
Returns:
the string representation.

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