@Override public int compare(PersonAttributeType pat1, PersonAttributeType pat2) { return OpenmrsUtil.compareWithNullAsGreatest(pat1.getPersonAttributeTypeId(), pat2.getPersonAttributeTypeId()); } }
@Override public int compare(PersonAttribute pa1, PersonAttribute pa2) { int retValue; if ((retValue = OpenmrsUtil.compareWithNullAsGreatest(pa1.getAttributeType(), pa2.getAttributeType())) != 0) { return retValue; } if ((retValue = pa1.getVoided().compareTo(pa2.getVoided())) != 0) { return retValue; } if ((retValue = OpenmrsUtil.compareWithNullAsLatest(pa1.getDateCreated(), pa2.getDateCreated())) != 0) { return retValue; } if ((retValue = OpenmrsUtil.compareWithNullAsGreatest(pa1.getValue(), pa2.getValue())) != 0) { return retValue; } return OpenmrsUtil.compareWithNullAsGreatest(pa1.getPersonAttributeId(), pa2.getPersonAttributeId()); } }
/** * @see java.lang.Comparable#compareTo(java.lang.Object) * Note: this comparator imposes orderings that are inconsistent with equals. */ @SuppressWarnings("squid:S1210") @Override public int compareTo(Attribute other) { if (other == null) { return -1; } int retValue = getVoided().compareTo(other.getVoided()); if (retValue == 0) { retValue = OpenmrsUtil.compareWithNullAsGreatest(getAttributeType().getId(), other.getAttributeType().getId()); } if (retValue == 0) { retValue = OpenmrsUtil.compareWithNullAsGreatest(getValueReference(), other.getValueReference()); } if (retValue == 0) { retValue = OpenmrsUtil.compareWithNullAsGreatest(getId(), other.getId()); } return retValue; }
ret = OpenmrsUtil.compareWithNullAsGreatest(pn1.getFamilyName(), pn2.getFamilyName()); ret = OpenmrsUtil.compareWithNullAsGreatest(pn1.getFamilyName2(), pn2.getFamilyName2()); ret = OpenmrsUtil.compareWithNullAsGreatest(pn1.getGivenName(), pn2.getGivenName()); ret = OpenmrsUtil.compareWithNullAsGreatest(pn1.getMiddleName(), pn2.getMiddleName()); ret = OpenmrsUtil.compareWithNullAsGreatest(pn1.getFamilyNamePrefix(), pn2.getFamilyNamePrefix()); ret = OpenmrsUtil.compareWithNullAsGreatest(pn1.getFamilyNameSuffix(), pn2.getFamilyNameSuffix());
PersonName name2 = person2.getPersonName(); int ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyName() != null ? name1.getFamilyName().toLowerCase() : null, name2.getFamilyName() != null ? name2.getFamilyName().toLowerCase() : null); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyName2() != null ? name1.getFamilyName().toLowerCase() : null, name2.getFamilyName2() != null ? name2.getFamilyName2().toLowerCase() : null); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getGivenName() != null ? name1.getGivenName().toLowerCase() : null, name2.getGivenName() != null ? name2.getGivenName().toLowerCase() : null); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getMiddleName() != null ? name1.getMiddleName().toLowerCase() : null, name2.getMiddleName() != null ? name2.getMiddleName().toLowerCase() : null); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyNamePrefix() != null ? name1.getFamilyNamePrefix() .toLowerCase() : null, name2.getFamilyNamePrefix() != null ? name2.getFamilyNamePrefix().toLowerCase() : null); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyNameSuffix() != null ? name1.getFamilyNameSuffix() .toLowerCase() : null, name2.getFamilyNameSuffix() != null ? name2.getFamilyNameSuffix().toLowerCase() : null);
/** * @see java.lang.Comparable#compareTo(java.lang.Object) * Note: this comparator imposes orderings that are inconsistent with equals. */ @Override @SuppressWarnings("squid:S1210") public int compareTo(PersonAddress other) { int retValue = 0; if (other != null) { retValue = getVoided().compareTo(other.getVoided()); if (retValue == 0) { retValue = other.getPreferred().compareTo(getPreferred()); } if (retValue == 0 && getDateCreated() != null) { retValue = OpenmrsUtil.compareWithNullAsLatest(getDateCreated(), other.getDateCreated()); } if (retValue == 0) { retValue = OpenmrsUtil.compareWithNullAsGreatest(getPersonAddressId(), other.getPersonAddressId()); } // if we've gotten this far, just check all address values. If they are // equal, leave the objects at 0. If not, arbitrarily pick retValue=1 // and return that (they are not equal). if (retValue == 0 && !equalsContent(other)) { retValue = 1; } } return retValue; }
/** * Compares by startDate with null as earliest and endDate with null as latest. * * @see java.lang.Comparable#compareTo(java.lang.Object) * @should return positive if startDates equal and this endDate null * @should return negative if this startDate null * @should pass if two states have the same start date, end date and uuid * @should return positive or negative if two states have the same start date and end date but different uuids * Note: this comparator imposes orderings that are inconsistent with equals. */ @SuppressWarnings("squid:S1210") @Override public int compareTo(PatientState o) { int result = OpenmrsUtil.compareWithNullAsEarliest(getStartDate(), o.getStartDate()); if (result == 0) { result = OpenmrsUtil.compareWithNullAsLatest(getEndDate(), o.getEndDate()); } if (result == 0) { result = OpenmrsUtil.compareWithNullAsGreatest(getUuid(), o.getUuid()); } return result; } }
retValue = OpenmrsUtil.compareWithNullAsGreatest(pi1.getIdentifierType().getPatientIdentifierTypeId(), pi2.getIdentifierType().getPatientIdentifierTypeId()); retValue = OpenmrsUtil.compareWithNullAsGreatest(pi1.getIdentifier(), pi2.getIdentifier());
PersonName name2 = person2.getPersonName(); int ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyName(), name2.getFamilyName()); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyName2(), name2.getFamilyName2()); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getGivenName(), name2.getGivenName()); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getMiddleName(), name2.getMiddleName()); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyNamePrefix(), name2.getFamilyNamePrefix()); ret = OpenmrsUtil.compareWithNullAsGreatest(name1.getFamilyNameSuffix(), name2.getFamilyNameSuffix());