All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.andromda.metafacades.uml14.StateVertexFacadeLogicImpl Maven / Gradle / Ivy

Go to download

The UML 1.4 metafacades. This is the set of UML 1.4 metafacades implementations. These implement the common UML metafacades.

The newest version!
package org.andromda.metafacades.uml14;

import java.util.Collection;
import java.util.Iterator;
import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
import org.omg.uml.behavioralelements.activitygraphs.Partition;
import org.omg.uml.behavioralelements.statemachines.CompositeState;
import org.omg.uml.behavioralelements.statemachines.StateMachine;
import org.omg.uml.behavioralelements.statemachines.StateVertex;

/**
 * MetafacadeLogic implementation.
 *
 * @see org.andromda.metafacades.uml.StateVertexFacade
 * @author Bob Fields
 */
public class StateVertexFacadeLogicImpl
        extends StateVertexFacadeLogic
{
    private static final long serialVersionUID = 34L;
    /**
     * @param metaObject
     * @param context
     */
    public StateVertexFacadeLogicImpl(StateVertex metaObject,
                                      String context)
    {
        super(metaObject, context);
    }

    /**
     * @see org.andromda.metafacades.uml14.StateVertexFacadeLogic#handleGetStateMachine()
     */
    protected StateMachine handleGetStateMachine()
    {
        // throws NullPointer if metaObject has no Container... Need to check for null on return.
        if (metaObject.getContainer()==null)
        {
            return null;
        }
        return metaObject.getContainer().getStateMachine();
    }

    /**
     * @see org.andromda.metafacades.uml14.StateVertexFacadeLogic#handleGetContainer()
     */
    protected CompositeState handleGetContainer()
    {
        return metaObject.getContainer();
    }

    /**
     * @see org.andromda.metafacades.uml14.StateVertexFacadeLogic#handleGetIncomings()
     */
    protected Collection handleGetIncomings()
    {
        return metaObject.getIncoming();
    }

    /**
     * @see org.andromda.metafacades.uml14.StateVertexFacadeLogic#handleGetOutgoings()
     */
    protected Collection handleGetOutgoings()
    {
        return metaObject.getOutgoing();
    }

    /**
     * @return getStateMachine
     */
    public Object handleGetValidationOwner()
    {
        return getStateMachine();
    }

    /**
     * @see org.andromda.metafacades.uml14.StateVertexFacadeLogic#handleGetPartition()
     */
    protected Partition handleGetPartition()
    {
        Partition thePartition = null;

        final StateMachine stateMachine = metaObject.getContainer().getStateMachine();
        if (stateMachine instanceof ActivityGraph)
        {
            final ActivityGraph activityGraph = (ActivityGraph)stateMachine;
            final Collection partitions = activityGraph.getPartition();
            for (final Iterator partitionIterator = partitions.iterator(); partitionIterator.hasNext() && thePartition == null;)
            {
                final Partition partition = partitionIterator.next();
                if (partition.getContents().contains(metaObject))
                {
                    thePartition = partition;
                }
            }
        }

        return thePartition;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy