/** * Compare this PolicyInformation with another object for equality * * @param other object to be compared with this * @return true iff the PolicyInformation objects match */ public boolean equals(Object other) { if (!(other instanceof PolicyInformation)) return false; PolicyInformation piOther = (PolicyInformation) other; if (!policyIdentifier.equals(piOther.getPolicyIdentifier())) return false; return policyQualifiers.equals(piOther.getPolicyQualifiers()); }
/** * Write the PolicyInformation to the DerOutputStream. * * @param out the DerOutputStream to write the extension to. * @exception IOException on encoding errors. */ public void encode(DerOutputStream out) throws IOException { DerOutputStream tmp = new DerOutputStream(); policyIdentifier.encode(tmp); if (!policyQualifiers.isEmpty()) { DerOutputStream tmp2 = new DerOutputStream(); for (PolicyQualifierInfo pq : policyQualifiers) { tmp2.write(pq.getEncoded()); } tmp.write(DerValue.tag_Sequence, tmp2); } out.write(DerValue.tag_Sequence, tmp); }
/** Return a printable representation of the PolicyInformation. */ public String toString() { StringBuilder s = new StringBuilder(" [" + policyIdentifier.toString()); s.append(policyQualifiers + " ]\n"); return s.toString(); }
/** * Returns the hash code for this PolicyInformation. * * @return a hash code value. */ public int hashCode() { int myhash = 37 + policyIdentifier.hashCode(); myhash = 37 * myhash + policyQualifiers.hashCode(); return myhash; }