/** * Performs a reverse-reference lookup for slots that have * <code>InstanceValue</code>s referencing the specified instance * specification. * * @param instance * an instance specification * @return the slots referencing it (or an empty collection if none) */ private Collection<Slot> getSlotsReferencing(InstanceSpecification instance) { Collection<Slot> result = CollectionUtil.createNewSet(); for (EStructuralFeature.Setting setting : UML2Util .getNonNavigableInverseReferences(instance)) { if (setting.getEStructuralFeature() == UMLPackage.Literals.INSTANCE_VALUE__INSTANCE) { InstanceValue value = (InstanceValue) setting.getEObject(); if (value.getOwner() instanceof Slot) { result.add((Slot) value.getOwner()); } } } return result; }