git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@815358 13f79535-47bb-0310-9956-ffa450edef68tags/fop-1_0
@@ -541,13 +541,8 @@ public class PDFColor extends PDFPathPaint { | |||
return (new byte[0]); | |||
} | |||
/** | |||
* Check for equality of color with another object. | |||
* | |||
* @param obj the object to compare | |||
* @return true if colors are equal | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (!(obj instanceof PDFColor)) { | |||
return false; | |||
} |
@@ -526,8 +526,8 @@ public class PDFDocument { | |||
private Object findPDFObject(List list, PDFObject compare) { | |||
for (Iterator iter = list.iterator(); iter.hasNext();) { | |||
Object obj = iter.next(); | |||
if (compare.equals(obj)) { | |||
PDFObject obj = (PDFObject) iter.next(); | |||
if (compare.contentEquals(obj)) { | |||
return obj; | |||
} | |||
} |
@@ -63,13 +63,8 @@ public class PDFFileSpec extends PDFObject { | |||
* endobj | |||
*/ | |||
/** | |||
* Check if this equals another object. | |||
* | |||
* @param obj the object to compare | |||
* @return true if this equals other object | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (this == obj) { | |||
return true; | |||
} |
@@ -696,15 +696,8 @@ public class PDFFunction extends PDFObject { | |||
} | |||
/** | |||
* Check if this function is equal to another object. | |||
* This is used to find if a particular function already exists | |||
* in a document. | |||
* | |||
* @param obj the obj to compare | |||
* @return true if the functions are equal | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (obj == null) { | |||
return false; | |||
} |
@@ -175,10 +175,8 @@ public class PDFGState extends PDFObject { | |||
* endobj | |||
*/ | |||
/** | |||
* {@inheritDoc} | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (obj == this) { | |||
return true; | |||
} |
@@ -143,13 +143,8 @@ public class PDFGoTo extends PDFAction { | |||
* endobj | |||
*/ | |||
/** | |||
* Check if this equals another object. | |||
* | |||
* @param obj the object to compare | |||
* @return true if this equals other object | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (this == obj) { | |||
return true; | |||
} |
@@ -127,13 +127,8 @@ public class PDFGoToRemote extends PDFAction { | |||
* endobj | |||
*/ | |||
/** | |||
* Check if this equals another object. | |||
* | |||
* @param obj the object to compare | |||
* @return true if this equals other object | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (this == obj) { | |||
return true; | |||
} |
@@ -42,13 +42,8 @@ public class PDFLaunch extends PDFAction { | |||
return sb.toString(); | |||
} | |||
/** | |||
* Check if this equals another object. | |||
* | |||
* @param obj the object to compare | |||
* @return true if this equals other object | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (this == obj) { | |||
return true; | |||
} |
@@ -106,13 +106,8 @@ public class PDFLink extends PDFObject { | |||
* endobj | |||
*/ | |||
/** | |||
* Check if this equals another object. | |||
* | |||
* @param obj the object to compare | |||
* @return true if this equals other object | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (this == obj) { | |||
return true; | |||
} |
@@ -393,4 +393,20 @@ public abstract class PDFObject implements PDFWritable { | |||
return formatDateTime(time, TimeZone.getDefault()); | |||
} | |||
/** | |||
* Check if the other PDFObject has the same content as the current object. | |||
* <p> | |||
* Note: This function has a contract which is less binding than | |||
* {@link #equals(Object)}. Whereas equals would require all values to be | |||
* identical, this method is not required to check everything. In the case | |||
* of PDFObjects, this means that the overriding function does not have to | |||
* check for {@link #getObjectID()}. | |||
* | |||
* @param o | |||
* object to compare to. | |||
* @return true if the other object has the same content. | |||
*/ | |||
protected boolean contentEquals(PDFObject o) { | |||
return this.equals(o); | |||
} | |||
} |
@@ -336,13 +336,8 @@ public class PDFPattern extends PDFPathPaint { | |||
*/ | |||
public byte[] toPDF() { return null; } | |||
/** | |||
* Check if this pattern is equal to another. | |||
* | |||
* @param obj the object to compare against | |||
* @return true if the patterns are equal | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (obj == null) { | |||
return false; | |||
} |
@@ -529,14 +529,8 @@ public class PDFShading extends PDFObject { | |||
return (p.toString()); | |||
} | |||
/** | |||
* Check if this shading is equal to another shading. | |||
* This is used to check if a shading already exists. | |||
* | |||
* @param obj the object to compare against | |||
* @return true if the shadings are equal | |||
*/ | |||
public boolean equals(Object obj) { | |||
/** {@inheritDoc} */ | |||
protected boolean contentEquals(PDFObject obj) { | |||
if (obj == null) { | |||
return false; | |||
} |