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;
}
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;
}
}
* 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;
}
}
- /**
- * 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;
}
* endobj
*/
- /**
- * {@inheritDoc}
- */
- public boolean equals(Object obj) {
+ /** {@inheritDoc} */
+ protected boolean contentEquals(PDFObject obj) {
if (obj == this) {
return true;
}
* 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;
}
* 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;
}
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;
}
* 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;
}
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);
+ }
}
*/
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;
}
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;
}