|
fop 2.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.traits.MinOptMax
public final class MinOptMax
This class holds the resolved (as mpoints) form of a
LengthRangeProperty
or
SpaceProperty
type property value.
plus
,
minus
or mult
return a different instance. So it is
possible to pass around instances without copying.
MinOptMax
values are used during layout calculations.
Field Summary | |
---|---|
static MinOptMax |
ZERO
The zero MinOptMax instance with min == opt == max == 0 . |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
MinOptMax |
extendMinimum(int newMin)
Extends the minimum length to the given length if necessary, and adjusts opt and max accordingly. |
static MinOptMax |
getInstance(int value)
Returns an instance of MinOptMax with one fixed value for all three
properties (min, opt, max). |
static MinOptMax |
getInstance(int min,
int opt,
int max)
Returns an instance of MinOptMax with the given values. |
int |
getMax()
Returns the maximum value of this MinOptMax . |
int |
getMin()
Returns the minimum value of this MinOptMax . |
int |
getOpt()
Returns the optimum value of this MinOptMax . |
int |
getShrink()
Returns the shrinkability of this MinOptMax which is the absolute difference
between min and opt . |
int |
getStretch()
Returns the stretchability of this MinOptMax which is the absolute difference
between opt and max . |
int |
hashCode()
|
boolean |
isElastic()
Determines whether this MinOptMax allows for shrinking or stretching, which
means that at least one of the min or max values isn't equal to the opt value. |
boolean |
isNonZero()
Determines whether this MinOptMax represents a non-zero dimension, which means
that not all values (min, opt, max) are zero. |
boolean |
isStiff()
Determines whether this MinOptMax doesn't allow for shrinking or stretching,
which means that all values (min, opt, max) are the same. |
MinOptMax |
minus(int value)
Subtracts the given value from all three components of this instance and returns the result. |
MinOptMax |
minus(MinOptMax operand)
Returns the difference of this MinOptMax and the given
MinOptMax . |
MinOptMax |
minusMax(int maxOperand)
Do not use, backwards compatibility only. |
MinOptMax |
minusMin(int minOperand)
Do not use, backwards compatibility only. |
MinOptMax |
mult(int factor)
Returns the product of this MinOptMax and the given factor. |
MinOptMax |
plus(int value)
Adds the given value to all three components of this instance and returns the result. |
MinOptMax |
plus(MinOptMax operand)
Returns the sum of this MinOptMax and the given MinOptMax . |
MinOptMax |
plusMax(int maxOperand)
Do not use, backwards compatibility only. |
MinOptMax |
plusMin(int minOperand)
Do not use, backwards compatibility only. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final MinOptMax ZERO
MinOptMax
instance with min == opt == max == 0
.
Method Detail |
---|
public static MinOptMax getInstance(int min, int opt, int max) throws java.lang.IllegalArgumentException
MinOptMax
with the given values.
min
- the minimum valueopt
- the optimum valuemax
- the maximum value
java.lang.IllegalArgumentException
- if min > opt || max < opt
.public static MinOptMax getInstance(int value)
MinOptMax
with one fixed value for all three
properties (min, opt, max).
value
- the value for min, opt and max
isStiff()
public int getMin()
MinOptMax
.
MinOptMax
.public int getOpt()
MinOptMax
.
MinOptMax
.public int getMax()
MinOptMax
.
MinOptMax
.public int getShrink()
MinOptMax
which is the absolute difference
between min
and opt
.
MinOptMax
which is always non-negative.public int getStretch()
MinOptMax
which is the absolute difference
between opt
and max
.
MinOptMax
which is always non-negative.public MinOptMax plus(MinOptMax operand)
MinOptMax
and the given MinOptMax
.
operand
- the second operand of the sum (the first is this instance itself),
MinOptMax
and the given MinOptMax
.public MinOptMax plus(int value)
value
- value to add to the min, opt, max components
public MinOptMax minus(MinOptMax operand) throws java.lang.ArithmeticException
MinOptMax
and the given
MinOptMax
. This instance must be a compound of the operand and another
MinOptMax
, that is, there must exist a MinOptMax
m
such that this.equals(m.plus(operand))
. In other words, the operand
must have less shrink and stretch than this instance.
operand
- the value to be subtracted
MinOptMax
and the given
MinOptMax
.
java.lang.ArithmeticException
- if this instance has strictly less shrink or stretch
than the operandpublic MinOptMax minus(int value)
value
- value to subtract from the min, opt, max components
public MinOptMax plusMin(int minOperand) throws java.lang.IllegalArgumentException
minOperand
- the minimal value to be added.
java.lang.IllegalArgumentException
- if
min + minOperand > opt || max < opt
.public MinOptMax minusMin(int minOperand) throws java.lang.IllegalArgumentException
minOperand
- the minimal value to be subtracted.
java.lang.IllegalArgumentException
- if
min - minOperand > opt || max < opt
.public MinOptMax plusMax(int maxOperand) throws java.lang.IllegalArgumentException
maxOperand
- the maximal value to be added.
java.lang.IllegalArgumentException
- if
min > opt || max < opt + maxOperand
.public MinOptMax minusMax(int maxOperand) throws java.lang.IllegalArgumentException
maxOperand
- the maximal value to be subtracted.
java.lang.IllegalArgumentException
- if
min > opt || max < opt - maxOperand
.public MinOptMax mult(int factor) throws java.lang.IllegalArgumentException
MinOptMax
and the given factor.
factor
- the factor
MinOptMax
and the given factor
java.lang.IllegalArgumentException
- if the factor is negativepublic boolean isNonZero()
MinOptMax
represents a non-zero dimension, which means
that not all values (min, opt, max) are zero.
true
if this MinOptMax
represents a non-zero dimension;
false
otherwise.public boolean isStiff()
MinOptMax
doesn't allow for shrinking or stretching,
which means that all values (min, opt, max) are the same.
true
if whether this MinOptMax
doesn't allow for shrinking
or stretching; false
otherwise.isElastic()
public boolean isElastic()
MinOptMax
allows for shrinking or stretching, which
means that at least one of the min or max values isn't equal to the opt value.
true
if this MinOptMax
allows for shrinking or stretching;
false
otherwise.isStiff()
public MinOptMax extendMinimum(int newMin)
newMin
- the new minimum length
MinOptMax
instance with the minimum length extendedpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
fop 2.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |