]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
move layoutmgr/MinOptMax to traits/MinOptMax
authorWilliam Victor Mote <vmote@apache.org>
Thu, 28 Aug 2003 19:08:59 +0000 (19:08 +0000)
committerWilliam Victor Mote <vmote@apache.org>
Thu, 28 Aug 2003 19:08:59 +0000 (19:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196870 13f79535-47bb-0310-9956-ffa450edef68

26 files changed:
src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
src/java/org/apache/fop/layoutmgr/BreakPoss.java
src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
src/java/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
src/java/org/apache/fop/layoutmgr/LayoutContext.java
src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
src/java/org/apache/fop/layoutmgr/LineLayoutManager.java
src/java/org/apache/fop/layoutmgr/MinOptMax.java [deleted file]
src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
src/java/org/apache/fop/layoutmgr/SpaceSpecifier.java
src/java/org/apache/fop/layoutmgr/TextLayoutManager.java
src/java/org/apache/fop/layoutmgr/list/Item.java
src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/Body.java
src/java/org/apache/fop/layoutmgr/table/Caption.java
src/java/org/apache/fop/layoutmgr/table/Cell.java
src/java/org/apache/fop/layoutmgr/table/Row.java
src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
src/java/org/apache/fop/traits/MinOptMax.java [new file with mode: 0644]
src/java/org/apache/fop/traits/SpaceVal.java

index b718f720aa12c78bcb71476c5221341383e794c7..911b5b4f288974546d952f4b95ca0efd74eea329 100644 (file)
@@ -125,6 +125,7 @@ import java.awt.geom.Point2D;
 import java.awt.geom.Rectangle2D;
 
 import org.apache.fop.apps.*;
+import org.apache.fop.traits.*;
 
 /**
  * Concrete implementation of FOTreeVisitor for the purpose of adding
index f16acc3c4635149bf417083bfefc1023fb487b2a..22e4db026d0399cbc4b80959aa453b649c70519d 100644 (file)
@@ -63,6 +63,7 @@ import org.apache.fop.fo.properties.Overflow;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.area.CTM;
 import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for a block FO.
index c4e980c56325306717e309315d94d39db3c3ced6..2f628443394445ceddc66081af25d99a3fc1022a 100644 (file)
@@ -65,6 +65,7 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 import org.apache.fop.fonts.*;
 import org.apache.fop.apps.*;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for a block FO.
index f2d5251001cdb8cfbfe99f36900a358f8dc38861..bdbe06369b0ebe9712ea29d1a22d322a4078d751 100644 (file)
@@ -53,6 +53,7 @@ package org.apache.fop.layoutmgr;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.BlockParent;
 import org.apache.fop.area.Block;
+import org.apache.fop.traits.*;
 
 /**
  * Base LayoutManager class for all areas which stack their child
index 61184cbf83bae03876b827a0286951aa8b5af8d0..f4fcca41d71108f5ac37dcd026316d37841f73e8 100644 (file)
@@ -51,6 +51,7 @@
 package org.apache.fop.layoutmgr;
 
 import org.apache.fop.traits.LayoutProps;
+import org.apache.fop.traits.*;
 
 /**
  * Represents a break possibility for the layout manager.
index 86d101d6389b2e9d8777b934e8e17a8a6253456c..85263a045899835159717ab0b09d8436367e9378 100644 (file)
@@ -62,6 +62,7 @@ import org.apache.avalon.framework.logger.Logger;
 import java.util.List;
 import java.util.Map;
 import java.util.ArrayList;
+import org.apache.fop.traits.*;
 
 /**
  * Content Layout Manager.
index f9e850ea7399a93067cd7664fca9674d5a6b37ec..cfed1a58acf618f9b34cbe59e549ab3afeeffc05 100644 (file)
@@ -56,6 +56,7 @@ import org.apache.fop.area.BlockParent;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for an fo:flow object.
index b5c9cd1629a9fb1f8352fabc1f0242441b35abc7..e59b8d4c592ba477446e46c798407f7cb88b7a3b 100644 (file)
@@ -63,6 +63,7 @@ import org.apache.fop.area.Area;
 import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.area.inline.InlineParent;
 import org.apache.fop.area.inline.Space;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for objects which stack children in the inline direction,
index 6187ba9e9f3cf0a455da79e37c45667a9f92c3d6..e635230c50f82fd527120c610a2d85219db93471 100644 (file)
@@ -50,6 +50,8 @@
  */ 
 package org.apache.fop.layoutmgr;
 
+import org.apache.fop.traits.*;
+
 
 /**
  * This class is used to pass information to the getNextBreakPoss()
index 86d212c5049bc8129c65af5aae9cdc44fae24484..a84c8db16118c902e9b50683f5dda459d5adc01d 100644 (file)
@@ -53,6 +53,7 @@ package org.apache.fop.layoutmgr;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.inline.InlineArea;
 import org.apache.fop.fo.properties.VerticalAlign;
+import org.apache.fop.traits.*;
 
 /**
  * Base LayoutManager for leaf-node FObj, ie: ones which have no children.
index 39dcb25c4f8bddb5c6eed8a38a2f22c9ba83564b..d18ebaa513407ea355712024a64734f5cd4b755b 100644 (file)
@@ -64,6 +64,7 @@ import java.util.ListIterator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ArrayList;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for lines. It builds one or more lines containing
diff --git a/src/java/org/apache/fop/layoutmgr/MinOptMax.java b/src/java/org/apache/fop/layoutmgr/MinOptMax.java
deleted file mode 100644 (file)
index 2360e2c..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * $Id: MinOptMax.java,v 1.3 2003/03/07 07:58:51 jeremias Exp $
- * ============================================================================
- *                    The Apache Software License, Version 1.1
- * ============================================================================
- * 
- * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without modifica-
- * tion, are permitted provided that the following conditions are met:
- * 
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 
- * 3. The end-user documentation included with the redistribution, if any, must
- *    include the following acknowledgment: "This product includes software
- *    developed by the Apache Software Foundation (http://www.apache.org/)."
- *    Alternately, this acknowledgment may appear in the software itself, if
- *    and wherever such third-party acknowledgments normally appear.
- * 
- * 4. The names "FOP" and "Apache Software Foundation" must not be used to
- *    endorse or promote products derived from this software without prior
- *    written permission. For written permission, please contact
- *    apache@apache.org.
- * 
- * 5. Products derived from this software may not be called "Apache", nor may
- *    "Apache" appear in their name, without prior written permission of the
- *    Apache Software Foundation.
- * 
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * ============================================================================
- * 
- * This software consists of voluntary contributions made by many individuals
- * on behalf of the Apache Software Foundation and was originally created by
- * James Tauber <jtauber@jtauber.com>. For more information on the Apache
- * Software Foundation, please see <http://www.apache.org/>.
- */ 
-package org.apache.fop.layoutmgr;
-
-/**
- * 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.
- */
-public class MinOptMax implements java.io.Serializable, Cloneable {
-
-    /** Publicly visible min(imum), opt(imum) and max(imum) values.*/
-    public int min;
-    public int opt;
-    public int max;
-
-    /**
-     * New min/opt/max with zero values.
-     */
-    public MinOptMax() {
-        this(0);
-    }
-
-    /**
-     * New min/opt/max with one fixed value.
-     *
-     * @param val the value for min, opt and max
-     */
-    public MinOptMax(int val) {
-        this(val, val, val);
-    }
-
-    /**
-     * New min/opt/max with the three values.
-     *
-     * @param min the minimum value
-     * @param opt the optimum value
-     * @param max the maximum value
-     */
-    public MinOptMax(int min, int opt, int max) {
-        this.min = min;
-        this.opt = opt;
-        this.max = max;
-    }
-
-    /**
-     * @see java.lang.Object#clone()
-     */
-    public Object clone() {
-        try {
-            return super.clone();
-        } catch (CloneNotSupportedException ex) {
-            // SHOULD NEVER OCCUR - all members are primitive types!
-            return null;
-        }
-    }
-
-    /**
-     * Subtracts one MinOptMax instance from another returning a new one.
-     * @param op1 first instance to subtract from
-     * @param op2 second instance
-     * @return MinOptMax new instance
-     */
-    public static MinOptMax subtract(MinOptMax op1, MinOptMax op2) {
-        return new MinOptMax(op1.min - op2.max, op1.opt - op2.opt,
-                             op1.max - op2.min);
-    }
-
-    /**
-     * Adds one MinOptMax instance to another returning a new one.
-     * @param op1 first instance
-     * @param op2 second instance
-     * @return MinOptMax new instance
-     */
-    public static MinOptMax add(MinOptMax op1, MinOptMax op2) {
-        return new MinOptMax(op1.min + op2.min, op1.opt + op2.opt,
-                             op1.max + op2.max);
-    }
-
-    /**
-     * Multiplies a MinOptMax instance with a factor returning a new instance.
-     * @param op1 MinOptMax instance
-     * @param mult multiplier
-     * @return MinOptMax new instance
-     */
-    public static MinOptMax multiply(MinOptMax op1, double mult) {
-        return new MinOptMax((int)(op1.min * mult),
-                             (int)(op1.opt * mult), (int)(op1.max * mult));
-    }
-
-    /**
-     * Adds another MinOptMax instance to this one.
-     * @param op the other instance
-     */
-    public void add(MinOptMax op) {
-        min += op.min;
-        opt += op.opt;
-        max += op.max;
-    }
-
-    /**
-     * Subtracts from this instance using another.
-     * @param op the other instance
-     */
-    public void subtract(MinOptMax op) {
-        min -= op.max;
-        opt -= op.opt;
-        max -= op.min;
-    }
-
-}
-
index d37f24fd86381fc22d06179d4b99df651439d129..5a202c2d20f8e4fb3f0900cd962e6bc4ae7fe451 100644 (file)
@@ -91,6 +91,7 @@ import java.util.Map;
 import java.awt.Rectangle;
 import java.util.Iterator;
 import java.awt.geom.Rectangle2D;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for a PageSequence and its flow.
index a6a716f6aa9a0cee6d5d8414d0793e4218fcf01e..ef14615d78d97d19be01b50d068b91861f58b39b 100644 (file)
@@ -53,6 +53,7 @@ package org.apache.fop.layoutmgr;
 import org.apache.fop.traits.SpaceVal;
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.fop.traits.*;
 
 /**
  * Accumulate a sequence of space-specifiers (XSL space type) on
index 903f8c51bb3c3ee999068d3a4ce07f9e89242c9d..9afe92f7aa119f91157e2657d3467e3181fc080c 100644 (file)
@@ -60,6 +60,7 @@ import org.apache.fop.area.inline.Word;
 import org.apache.fop.area.inline.Space;
 import org.apache.fop.util.CharUtilities;
 import org.apache.fop.fonts.*;
+import org.apache.fop.traits.*;
 
 /**
  * LayoutManager for text (a sequence of characters) which generates one
index c9f4ff2977911a61d6d1fb3a59228005030ef722..dca5868945f2ba34d3f0daef77d85dd969843f44 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
index 1ac46d33d24d24bb4e99f1548b9bbee029b12a54..0a8fd15ea338b76007939de4a92eac8eb9aa40b6 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
index b0acd38964215ee87df0581128596102d9d5de62..49d58129d8c5cf00d785e29727fae876e400d6a5 100644 (file)
@@ -61,7 +61,7 @@ import org.apache.fop.layoutmgr.BreakPossPosIter;
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
index f58d6ea4b41c67d94129ac487a2ee2bf748f4ab7..5efbd7514e10f0091d929d7e2742d2fce2576a56 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
index da6ebeeb8595152195411e1dc01c857558d6959b..84f21b8fff163808a410bd9bd2a01d1f441cb934 100644 (file)
@@ -60,7 +60,7 @@ import org.apache.fop.layoutmgr.BreakPossPosIter;
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 
 import java.util.ArrayList;
 import java.util.List;
index 08f1d84029d3844023398f10361218c27a316a8f..a89dcd1d90416bfb071c005d67f6dde4ee1908ff 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
index a22c6cab46fdbe691a2247b7d7f182df2168eb31..de884e9a59759e8dbf2d1a477dc5f7d643231c81 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
index 5160fff1144a672a3c227edfdbcedd39be2563c1..424794730a2b3097d68ed03bdac0f8fc6949c2ff 100644 (file)
@@ -60,7 +60,7 @@ import org.apache.fop.layoutmgr.BreakPossPosIter;
 import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 
 import java.util.ArrayList;
 import java.util.List;
index 3c4303f48f22bd057e2d5f61d6e4c8610f3c7f0f..b56cd3e9400a96f8d2db93cab22343a1219a91c2 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layoutmgr.Position;
 import org.apache.fop.layoutmgr.TraitSetter;
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
-import org.apache.fop.layoutmgr.MinOptMax;
+import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
 
diff --git a/src/java/org/apache/fop/traits/MinOptMax.java b/src/java/org/apache/fop/traits/MinOptMax.java
new file mode 100644 (file)
index 0000000..114c4e0
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * $Id$
+ * ============================================================================
+ *                    The Apache Software License, Version 1.1
+ * ============================================================================
+ * 
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 
+ * 3. The end-user documentation included with the redistribution, if any, must
+ *    include the following acknowledgment: "This product includes software
+ *    developed by the Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself, if
+ *    and wherever such third-party acknowledgments normally appear.
+ * 
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ *    endorse or promote products derived from this software without prior
+ *    written permission. For written permission, please contact
+ *    apache@apache.org.
+ * 
+ * 5. Products derived from this software may not be called "Apache", nor may
+ *    "Apache" appear in their name, without prior written permission of the
+ *    Apache Software Foundation.
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ * 
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */ 
+package org.apache.fop.traits;
+
+/**
+ * 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.
+ */
+public class MinOptMax implements java.io.Serializable, Cloneable {
+
+    /** Publicly visible min(imum), opt(imum) and max(imum) values.*/
+    public int min;
+    public int opt;
+    public int max;
+
+    /**
+     * New min/opt/max with zero values.
+     */
+    public MinOptMax() {
+        this(0);
+    }
+
+    /**
+     * New min/opt/max with one fixed value.
+     *
+     * @param val the value for min, opt and max
+     */
+    public MinOptMax(int val) {
+        this(val, val, val);
+    }
+
+    /**
+     * New min/opt/max with the three values.
+     *
+     * @param min the minimum value
+     * @param opt the optimum value
+     * @param max the maximum value
+     */
+    public MinOptMax(int min, int opt, int max) {
+        this.min = min;
+        this.opt = opt;
+        this.max = max;
+    }
+
+    /**
+     * @see java.lang.Object#clone()
+     */
+    public Object clone() {
+        try {
+            return super.clone();
+        } catch (CloneNotSupportedException ex) {
+            // SHOULD NEVER OCCUR - all members are primitive types!
+            return null;
+        }
+    }
+
+    /**
+     * Subtracts one MinOptMax instance from another returning a new one.
+     * @param op1 first instance to subtract from
+     * @param op2 second instance
+     * @return MinOptMax new instance
+     */
+    public static MinOptMax subtract(MinOptMax op1, MinOptMax op2) {
+        return new MinOptMax(op1.min - op2.max, op1.opt - op2.opt,
+                             op1.max - op2.min);
+    }
+
+    /**
+     * Adds one MinOptMax instance to another returning a new one.
+     * @param op1 first instance
+     * @param op2 second instance
+     * @return MinOptMax new instance
+     */
+    public static MinOptMax add(MinOptMax op1, MinOptMax op2) {
+        return new MinOptMax(op1.min + op2.min, op1.opt + op2.opt,
+                             op1.max + op2.max);
+    }
+
+    /**
+     * Multiplies a MinOptMax instance with a factor returning a new instance.
+     * @param op1 MinOptMax instance
+     * @param mult multiplier
+     * @return MinOptMax new instance
+     */
+    public static MinOptMax multiply(MinOptMax op1, double mult) {
+        return new MinOptMax((int)(op1.min * mult),
+                             (int)(op1.opt * mult), (int)(op1.max * mult));
+    }
+
+    /**
+     * Adds another MinOptMax instance to this one.
+     * @param op the other instance
+     */
+    public void add(MinOptMax op) {
+        min += op.min;
+        opt += op.opt;
+        max += op.max;
+    }
+
+    /**
+     * Subtracts from this instance using another.
+     * @param op the other instance
+     */
+    public void subtract(MinOptMax op) {
+        min -= op.max;
+        opt -= op.opt;
+        max -= op.min;
+    }
+
+}
+
index 579c56099435dbfd360a0a0ef1b4edf76832e551..762b65305c8136347ec7b5f412074236764c5418 100644 (file)
@@ -51,7 +51,7 @@
 package org.apache.fop.traits;
 
 import org.apache.fop.datatypes.Space;
-import org.apache.fop.layoutmgr.MinOptMax;
+
 import org.apache.fop.fo.Property;
 import org.apache.fop.fo.properties.Constants;