diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2012-03-22 17:04:12 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2012-03-22 17:04:12 +0000 |
commit | 4e26880397f917dc537993896adff1dcc0e96685 (patch) | |
tree | 9d7c0e3da776534d020f276cfaf42f189b91fb81 /src/java/org/apache/fop/fo/properties/TableColLength.java | |
parent | c1653ad47548cff23a614559544fe0b0aec3522d (diff) | |
download | xmlgraphics-fop-4e26880397f917dc537993896adff1dcc0e96685.tar.gz xmlgraphics-fop-4e26880397f917dc537993896adff1dcc0e96685.zip |
Bugzilla #46962: Fixed deadlock in PropertyCache.
Re-wrote the PropertyCache class, leveraging Java 1.5 concurrency features.
Implemented equals and hashCode on many Property sub-classes to make the caching more effective
Patch by Alexios Giotis, applied with the following minor modifications:
* Javadoc improvements to PropertyCache
* Factorize into new CompareUtil class code often used by equals and hashCode implementations
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1303891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/properties/TableColLength.java')
-rw-r--r-- | src/java/org/apache/fop/fo/properties/TableColLength.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fo/properties/TableColLength.java b/src/java/org/apache/fop/fo/properties/TableColLength.java index ccb85bcfb..6c30b3123 100644 --- a/src/java/org/apache/fop/fo/properties/TableColLength.java +++ b/src/java/org/apache/fop/fo/properties/TableColLength.java @@ -22,6 +22,7 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.LengthBase; import org.apache.fop.datatypes.PercentBaseContext; import org.apache.fop.fo.FObj; +import org.apache.fop.util.CompareUtil; /** * A table-column width specification, possibly including some @@ -111,4 +112,25 @@ public class TableColLength extends LengthProperty { return (Double.toString(tcolUnits) + " table-column-units"); } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + CompareUtil.getHashCode(column); + result = prime * result + CompareUtil.getHashCode(tcolUnits); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof TableColLength)) { + return false; + } + TableColLength other = (TableColLength) obj; + return CompareUtil.equal(column, other.column) + && CompareUtil.equal(tcolUnits, other.tcolUnits); + } } |