summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/c2kernel/collection/Parent2ChildCollection.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java b/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java
index c59132e..d59b613 100644
--- a/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java
+++ b/src/main/java/com/c2kernel/collection/Parent2ChildCollection.java
@@ -1,5 +1,7 @@
package com.c2kernel.collection;
+import java.util.Iterator;
+
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.utils.CastorHashMap;
@@ -124,4 +126,18 @@ abstract public class Parent2ChildCollection<E extends CollectionMember> impleme
@Override
public abstract E addMember(int entityKey, CastorHashMap props, String classProps) throws MembershipException;
+ public boolean equals(Parent2ChildCollection<?> other) {
+ boolean same = mName.equals(other.getName()) && mURLInfo.equals(other.getURLInfo()) && size() == other.size();
+ if (!same) return false;
+ for (Iterator<E> i = getMembers().list.iterator(); i.hasNext();) {
+ try {
+ CollectionMember thisMem = i.next();
+ CollectionMember otherMem = other.getMember(thisMem.getID());
+ if (!thisMem.equals(otherMem)) return false;
+ } catch (ObjectNotFoundException ex) {
+ return false;
+ }
+ }
+ return true;
+ }
}