aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-10-19 13:40:13 +0000
committerFinn Bock <bckfnn@apache.org>2004-10-19 13:40:13 +0000
commit23a611f6b9d421eeee97831c449c3f603b54fff2 (patch)
treed0a811c4d80416433acb9631d99f40e772ac9fae /src
parent2c38e2ca1bb7e512cd484a34c2459f1c07611bb2 (diff)
downloadxmlgraphics-fop-23a611f6b9d421eeee97831c449c3f603b54fff2.tar.gz
xmlgraphics-fop-23a611f6b9d421eeee97831c449c3f603b54fff2.zip
Initial version.
PR: 31699 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198062 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rwxr-xr-xsrc/java/org/apache/fop/fo/StaticPropertyList.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fo/StaticPropertyList.java b/src/java/org/apache/fop/fo/StaticPropertyList.java
new file mode 100755
index 000000000..d1a3b67e4
--- /dev/null
+++ b/src/java/org/apache/fop/fo/StaticPropertyList.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.fop.fo;
+
+import org.apache.fop.fo.properties.Property;
+
+/**
+ * A very fast implementation of PropertyList that uses arrays to store
+ * the explit set properties and another array to store cached values.
+ */
+public class StaticPropertyList extends PropertyList {
+ private Property[] explicit;
+ private Property[] values;
+
+ /**
+ * Construct a StaticPropertyList.
+ * @param fObjToAttach The FObj object.
+ * @param parentPropertyList The parent property list.
+ */
+ public StaticPropertyList(FObj fObjToAttach, PropertyList parentPropertyList) {
+ super(fObjToAttach, parentPropertyList);
+ explicit = new Property[Constants.PROPERTY_COUNT + 1];
+ values = new Property[Constants.PROPERTY_COUNT + 1];
+ }
+
+ /**
+ * Return the value explicitly specified on this FO.
+ * @param propId The ID of the property whose value is desired.
+ * @return The value if the property is explicitly set, otherwise null.
+ */
+ public Property getExplicit(int propId) {
+ return explicit[propId];
+ }
+
+ /**
+ * Set an value defined explicitly on this FO.
+ * @param propId The ID of the property whose value is desired.
+ * @param value The value of the property to set.
+ */
+ public void putExplicit(int propId, Property value) {
+ explicit[propId] = value;
+ }
+
+ /**
+ * Override PropertyList.get() and provides fast caching of previously
+ * retrieved property values.
+ * @param propId The property ID
+ */
+ public Property get(int propId, boolean bTryInherit, boolean bTryDefault) {
+ Property p = values[propId];
+ if (p == null) {
+ p = values[propId] = super.get(propId, bTryInherit, bTryDefault);
+ }
+ return p;
+ }
+}