/** * This method is an alternative equals to the CvObject.equals method, that basically checks * on the MI identifiers and then of the short label if the first check returns false * * @param cv1 One of the CvObjects * @param cv2 The other CvObject * @param includeCollectionsCheck if true, check if the annotations/xrefs/aliases are the same * @return True if (A) the MI are the same or (B) the short labels are the same in case A has failed * @since 1.9.0 */ public static boolean areEqual(CvObject cv1, CvObject cv2, boolean includeCollectionsCheck) { if (cv1 == null || cv2 == null) { return false; } if (includeCollectionsCheck && AnnotatedObjectUtils.isNewOrManaged(cv1) && AnnotatedObjectUtils.isNewOrManaged(cv2)) { if (!AnnotatedObjectUtils.containSameCollections(cv1, cv2)) { return false; } } if (cv1.getIdentifier() != null && cv2.getIdentifier() != null) { if (!cv1.getIdentifier().equals(cv2.getIdentifier())) { return false; } } if (cv1.getShortLabel() == null || cv2.getShortLabel() == null) { return false; } return cv1.getShortLabel().equals(cv2.getShortLabel()); }
/** * This method is an alternative equals to the CvObject.equals method, that basically checks * on the MI identifiers and then of the short label if the first check returns false * * @param cv1 One of the CvObjects * @param cv2 The other CvObject * @param includeCollectionsCheck if true, check if the annotations/xrefs/aliases are the same * @return True if (A) the MI are the same or (B) the short labels are the same in case A has failed * @since 1.9.0 */ public static boolean areEqual(CvObject cv1, CvObject cv2, boolean includeCollectionsCheck) { if (cv1 == null || cv2 == null) { return false; } if (includeCollectionsCheck && AnnotatedObjectUtils.isNewOrManaged(cv1) && AnnotatedObjectUtils.isNewOrManaged(cv2)) { if (!AnnotatedObjectUtils.containSameCollections(cv1, cv2)) { return false; } } if (cv1.getIdentifier() != null && cv2.getIdentifier() != null) { if (!cv1.getIdentifier().equals(cv2.getIdentifier())) { return false; } } if (cv1.getShortLabel() == null || cv2.getShortLabel() == null) { return false; } return cv1.getShortLabel().equals(cv2.getShortLabel()); }
if (!AnnotatedObjectUtils.isNewOrManaged(ao)) { Class<? extends AnnotatedObject> clazz = ao.getClass(); String ac = ao.getAc();
if (!AnnotatedObjectUtils.isNewOrManaged(ao)) { Class<? extends AnnotatedObject> clazz = ao.getClass(); String ac = ao.getAc();