@Override public RelationSchema getClone() { RelationSchema clone; ArrayList<Attribute> clonesAttributes = new ArrayList<>(); ArrayList<FunctionalDependency> clonesFunctionalDependencies = new ArrayList<>(); for (Attribute attribute : attributes) { clonesAttributes.add((Attribute) attribute.getClone()); } for (FunctionalDependency dependency : functionalDependencies) { clonesFunctionalDependencies.add(dependency.getClone()); } clone = new RelationSchema(name, clonesAttributes, clonesFunctionalDependencies); clone.setOwnId(ownId); clone.restoreReferences(); clone.initPropertyChangeListeners(); clone.setDirty(super.isDirty()); return clone; }
@Override public boolean equals(Object object) { if (object instanceof RelationSchema) { RelationSchema otherSchema = (RelationSchema) object; if (!name.equals(otherSchema.getName())) { return false; } if (!attributes.equals(otherSchema.getAttributes())) { return false; } if (!functionalDependencies.equals(otherSchema.getFunctionalDependencies())) { return false; } } return true; }