int object_id1 = aP.getObjectId().intValue(); Collection class_name1 = aP.getClassNames(); int object_id2 = pP.getObjectId().intValue(); Collection class_name2 = pP.getClassNames();
    public void executeUnrelateAction( UnrelateAction a, Context c ) throws LemRuntimeException {        // verify the action is valid        boolean valid_active, valid_passive;        valid_active = valid_passive = false;        Instance active = null;        Instance passive = null;                runtime.Object aP = (runtime.Object)(( ObjectReferenceVariable ) c.getVariable( a.getActiveObjectName() )).getValue();        runtime.Object pP = (runtime.Object)(( ObjectReferenceVariable ) c.getVariable( a.getPassiveObjectName() )).getValue();                // retrieve the names of the classes participating in the association        metamodel.Class aP_class = a.getAssociation().getActivePerspective().getDomainClass();        metamodel.Class pP_class = a.getAssociation().getPassivePerspective().getDomainClass();                Collection ac = aP.getInstances();        Collection pc = pP.getInstances();                Iterator i = ac.iterator();        while ( i.hasNext() && !( valid_passive || valid_active ) ) {            active = ( Instance ) i.next();            if ( active.getInstanceClass() == aP_class )                valid_active = true;            else if ( active.getInstanceClass() == pP_class )                valid_passive = true;        }        if ( !( valid_active || valid_passive ) )            throw new LemRuntimeException( "Objects does not have the required instances for association " + a.getAssociation().getName() );                i = pc.iterator();        while ( i.hasNext() && !( valid_passive && valid_active ) ) {            passive = ( Instance ) i.next();            if ( passive.getInstanceClass() == pP_class )                valid_passive = true;            else if ( passive.getInstanceClass() == aP_class )                valid_active = true;        }        if ( !( valid_active && valid_passive ) )            throw new LemRuntimeException( "Objects does not have the required instances for association " + a.getAssociation().getName() );                // update the runtime model        AssociationInstance aInst = new AssociationInstance( a.getAssociation() );        aInst.setActiveInstance( active );        aInst.setPassiveInstance( passive );        AssociationInstance aInst2 = c.containsAssociationInstance( aInst );        if ( aInst2 == null)            throw new LemRuntimeException( "The association does not exist between the two objects" );                c.removeAssociationInstance( aInst2 );        // create a new LemEvent and notify all listeners        int object_id1 = aP.getObjectId().intValue();        Collection class_name1 = aP.getClassNames();                int object_id2 = pP.getObjectId().intValue();           Collection class_name2 = pP.getClassNames();                int association_id = aInst2.getAssociationId().intValue();        if(aInst2.getLinkObjectInstance() == null)            new LemRelationshipDeletionEvent( object_id1, class_name1, object_id2, class_name2, association_id ).notifyAll( c );        else             new LemRelationshipDeletionEvent( object_id1, class_name1, object_id2, class_name2, association_id, aInst2.getLinkObjectInstance().getObjectId().intValue()).notifyAll( c );                        }