org.apache.fop.traits

Class MinOptMax

Implemented Interfaces:
Cloneable, java.io.Serializable

public class MinOptMax
extends java.lang.Object
implements java.io.Serializable, Cloneable

This class holds the resolved (as mpoints) form of a LengthRange or Space type Property value. MinOptMax values are used during layout calculations. The instance variables are package visible.
See Also:
Serialized Form

Field Summary

int
max
int
min
Publicly visible min(imum), opt(imum) and max(imum) values.
int
opt

Constructor Summary

MinOptMax()
New min/opt/max with zero values.
MinOptMax(int val)
New min/opt/max with one fixed value.
MinOptMax(int min, int opt, int max)
New min/opt/max with the three values.
MinOptMax(MinOptMax op)
Copy constructor.

Method Summary

void
add(int len)
Adds a length to all components.
void
add(int min, int opt, int max)
Adds min, opt and max to their counterpart components.
void
add(MinOptMax op)
Adds another MinOptMax instance to this one.
static MinOptMax
add(MinOptMax op1, MinOptMax op2)
Adds one MinOptMax instance to another returning a new one.
Object
clone()
boolean
isElastic()
boolean
isNonZero()
static MinOptMax
multiply(MinOptMax op1, double mult)
Multiplies a MinOptMax instance with a factor returning a new instance.
void
subtract(MinOptMax op)
Subtracts another MinOptMax instance from this one.
static MinOptMax
subtract(MinOptMax op1, MinOptMax op2)
Subtracts one MinOptMax instance from another returning a new one.
String
toString()

Field Details

max

public int max

min

public int min
Publicly visible min(imum), opt(imum) and max(imum) values.

opt

public int opt

Constructor Details

MinOptMax

public MinOptMax()
New min/opt/max with zero values.

MinOptMax

public MinOptMax(int val)
New min/opt/max with one fixed value.
Parameters:
val - the value for min, opt and max

MinOptMax

public MinOptMax(int min,
                 int opt,
                 int max)
New min/opt/max with the three values.
Parameters:
min - the minimum value
opt - the optimum value
max - the maximum value

MinOptMax

public MinOptMax(MinOptMax op)
Copy constructor.
Parameters:
op - the MinOptMax object to copy

Method Details

add

public void add(int len)
Adds a length to all components.
Parameters:
len - the length to add

add

public void add(int min,
                int opt,
                int max)
Adds min, opt and max to their counterpart components.
Parameters:
min - the value to add to the minimum value
opt - the value to add to the optimum value
max - the value to add to the maximum value

add

public void add(MinOptMax op)
Adds another MinOptMax instance to this one.
Parameters:
op - the other instance

add

public static MinOptMax add(MinOptMax op1,
                            MinOptMax op2)
Adds one MinOptMax instance to another returning a new one.
Parameters:
op1 - first instance
op2 - second instance
Returns:
MinOptMax new instance

clone

public Object clone()
See Also:
java.lang.Object.clone()

isElastic

public boolean isElastic()
Returns:
true if this instance allows for shrinking or stretching

isNonZero

public boolean isNonZero()
Returns:
true if this instance represents a zero-width length (min=opt=max=0)

multiply

public static MinOptMax multiply(MinOptMax op1,
                                 double mult)
Multiplies a MinOptMax instance with a factor returning a new instance.
Parameters:
op1 - MinOptMax instance
mult - multiplier
Returns:
MinOptMax new instance

subtract

public void subtract(MinOptMax op)
Subtracts another MinOptMax instance from this one.
Parameters:
op - the other instance

subtract

public static MinOptMax subtract(MinOptMax op1,
                                 MinOptMax op2)
Subtracts one MinOptMax instance from another returning a new one.
Parameters:
op1 - first instance to subtract from
op2 - second instance
Returns:
MinOptMax new instance

toString

public String toString()
See Also:
java.lang.Object.toString()

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