diff options
author | Karen Lease <klease@apache.org> | 2001-11-09 21:59:02 +0000 |
---|---|---|
committer | Karen Lease <klease@apache.org> | 2001-11-09 21:59:02 +0000 |
commit | 0061d6a6fffd5285b55fc988d5986461086d1a75 (patch) | |
tree | 7550f8928b7ae8b793eba05c2f8494930a509352 /src/org | |
parent | 76a43e26132766467c569b7938ed27cac5354dd2 (diff) | |
download | xmlgraphics-fop-0061d6a6fffd5285b55fc988d5986461086d1a75.tar.gz xmlgraphics-fop-0061d6a6fffd5285b55fc988d5986461086d1a75.zip |
Used in layout calculations
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194540 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/apache/fop/area/MinOptMax.java | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/org/apache/fop/area/MinOptMax.java b/src/org/apache/fop/area/MinOptMax.java new file mode 100644 index 000000000..e7ed4add5 --- /dev/null +++ b/src/org/apache/fop/area/MinOptMax.java @@ -0,0 +1,61 @@ +/* + * $Id$ + * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. + */ + +package org.apache.fop.area; + +/** + * 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 { + + /** Publicly visible min(imum), opt(imum) and max(imum) values.*/ + public int min; + public int opt; + public int max; + + public MinOptMax() { + this(0); + } + + public MinOptMax(int val) { + this(val, val, val); + } + + public MinOptMax(int min, int opt, int max) { + this.min = min; + this.opt = opt; + this.max = max; + } + + public static MinOptMax subtract(MinOptMax op1, MinOptMax op2) { + return new MinOptMax(op1.min - op2.max, op1.opt - op2.opt, + op1.max - op2.min); + } + + public static MinOptMax add(MinOptMax op1, MinOptMax op2) { + return new MinOptMax(op1.min + op2.min, op1.opt + op2.opt, + op1.max + op2.max); + } + + public void add(MinOptMax op) { + min += op.min; + opt += op.opt; + max += op.max; + } + + public void subtract(MinOptMax op) { + min -= op.max; + opt -= op.opt; + max -= op.min; + } + + +} |