@Override
    public boolean equals(Object o) {
        if (super.equals(o)) {
            // they are the same object
            return true;
        } else if (type == INDIRECT && o instanceof PDFObject) {
            // they are both PDFObjects.  Check type and xref.
            PDFObject obj = (PDFObject) o;

            if (obj.type == INDIRECT) {
                PDFXref lXref = (PDFXref) value;
                PDFXref rXref = (PDFXref) obj.value;

                return ((lXref.getObjectNumber() == rXref.getObjectNumber()) &&
                        (lXref.getGeneration() == rXref.getGeneration()));
            }
        }

        return false;
    }