001package org.andromda.metafacades.uml14;
002
003import org.andromda.metafacades.uml.ActionStateFacade;
004import org.andromda.metafacades.uml.FinalStateFacade;
005import org.andromda.metafacades.uml.PseudostateFacade;
006import org.andromda.metafacades.uml.StateVertexFacade;
007import org.omg.uml.behavioralelements.commonbehavior.Action;
008import org.omg.uml.behavioralelements.statemachines.Event;
009import org.omg.uml.behavioralelements.statemachines.Guard;
010import org.omg.uml.behavioralelements.statemachines.StateVertex;
011import org.omg.uml.behavioralelements.statemachines.Transition;
012
013/**
014 * Metaclass facade implementation.
015 * @author Bob Fields
016 */
017public class TransitionFacadeLogicImpl
018        extends TransitionFacadeLogic
019{
020    private static final long serialVersionUID = 34L;
021    /**
022     * @param metaObject
023     * @param context
024     */
025    public TransitionFacadeLogicImpl(Transition metaObject,
026                                     String context)
027    {
028        super(metaObject, context);
029    }
030
031    /**
032     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleGetEffect()
033     */
034    protected Action handleGetEffect()
035    {
036        return metaObject.getEffect();
037    }
038
039    /**
040     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleGetSource()
041     */
042    protected StateVertex handleGetSource()
043    {
044        return metaObject.getSource();
045    }
046
047    /**
048     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleGetTarget()
049     */
050    protected StateVertex handleGetTarget()
051    {
052        return metaObject.getTarget();
053    }
054
055    /**
056     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleGetTrigger()
057     */
058    protected Event handleGetTrigger()
059    {
060        return metaObject.getTrigger();
061    }
062
063    /**
064     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleGetGuard()
065     */
066    protected Guard handleGetGuard()
067    {
068        return metaObject.getGuard();
069    }
070
071    /**
072     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsTriggerPresent()
073     */
074    protected boolean handleIsTriggerPresent()
075    {
076        return metaObject.getTrigger() != null;
077    }
078
079    /**
080     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsExitingDecisionPoint()
081     */
082    protected boolean handleIsExitingDecisionPoint()
083    {
084        final StateVertexFacade sourceVertex = getSource();
085        return sourceVertex instanceof PseudostateFacade && ((PseudostateFacade)sourceVertex).isDecisionPoint();
086    }
087
088    /**
089     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsEnteringDecisionPoint()
090     */
091    protected boolean handleIsEnteringDecisionPoint()
092    {
093        final StateVertexFacade target = getTarget();
094        return target instanceof PseudostateFacade && ((PseudostateFacade)target).isDecisionPoint();
095    }
096
097    /**
098     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsExitingActionState()
099     */
100    protected boolean handleIsExitingActionState()
101    {
102        return getSource() instanceof ActionStateFacade;
103    }
104
105    /**
106     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsEnteringActionState()
107     */
108    protected boolean handleIsEnteringActionState()
109    {
110        return getTarget() instanceof ActionStateFacade;
111    }
112
113    /**
114     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsExitingInitialState()
115     */
116    protected boolean handleIsExitingInitialState()
117    {
118        StateVertexFacade sourceVertex = getSource();
119        return sourceVertex instanceof PseudostateFacade && ((PseudostateFacade)sourceVertex).isInitialState();
120    }
121
122    /**
123     * @see org.andromda.metafacades.uml14.TransitionFacadeLogic#handleIsEnteringFinalState()
124     */
125    protected boolean handleIsEnteringFinalState()
126    {
127        return getTarget() instanceof FinalStateFacade;
128    }
129
130    /**
131     * @return getTarget().getStateMachine()
132     */
133    public Object handleGetValidationOwner()
134    {
135        return getTarget().getStateMachine();
136    }
137
138}