EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.seff.edit.commands]

COVERAGE SUMMARY FOR SOURCE FILE [RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourReorientCommand.java]

nameclass, %method, %block, %line, %
RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourReorientCommand.java0%   (0/1)0%   (0/11)0%   (0/155)0%   (0/49)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourReorientCommand0%   (0/1)0%   (0/11)0%   (0/155)0%   (0/49)
RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourRe... 0%   (0/1)0%   (0/23)0%   (0/6)
canExecute (): boolean 0%   (0/1)0%   (0/22)0%   (0/7)
canReorientSource (): boolean 0%   (0/1)0%   (0/16)0%   (0/5)
canReorientTarget (): boolean 0%   (0/1)0%   (0/16)0%   (0/5)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/26)0%   (0/8)
getNewSource (): RecoveryActionBehaviour 0%   (0/1)0%   (0/4)0%   (0/1)
getNewTarget (): RecoveryActionBehaviour 0%   (0/1)0%   (0/4)0%   (0/1)
getOldSource (): RecoveryActionBehaviour 0%   (0/1)0%   (0/4)0%   (0/1)
getOldTarget (): RecoveryActionBehaviour 0%   (0/1)0%   (0/4)0%   (0/1)
reorientSource (): CommandResult 0%   (0/1)0%   (0/18)0%   (0/7)
reorientTarget (): CommandResult 0%   (0/1)0%   (0/18)0%   (0/7)

1/*
2 * Copyright 2006 SDQ Research Group, University of Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.edit.commands;
5 
6import org.eclipse.core.commands.ExecutionException;
7import org.eclipse.core.runtime.IAdaptable;
8import org.eclipse.core.runtime.IProgressMonitor;
9import org.eclipse.emf.ecore.EObject;
10import org.eclipse.gmf.runtime.common.core.command.CommandResult;
11import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
12import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
13import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
14 
15import de.uka.ipd.sdq.pcm.gmf.seff.edit.policies.PalladioComponentModelBaseItemSemanticEditPolicy;
16 
17/**
18 * @generated
19 */
20public class RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourReorientCommand
21                extends EditElementCommand {
22 
23        /**
24         * @generated
25         */
26        private final int reorientDirection;
27 
28        /**
29         * @generated
30         */
31        private final EObject referenceOwner;
32 
33        /**
34         * @generated
35         */
36        private final EObject oldEnd;
37 
38        /**
39         * @generated
40         */
41        private final EObject newEnd;
42 
43        /**
44         * @generated
45         */
46        public RecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviourReorientCommand(
47                        ReorientReferenceRelationshipRequest request) {
48                super(request.getLabel(), null, request);
49                reorientDirection = request.getDirection();
50                referenceOwner = request.getReferenceOwner();
51                oldEnd = request.getOldRelationshipEnd();
52                newEnd = request.getNewRelationshipEnd();
53        }
54 
55        /**
56         * @generated
57         */
58        public boolean canExecute() {
59                if (false == referenceOwner instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) {
60                        return false;
61                }
62                if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
63                        return canReorientSource();
64                }
65                if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
66                        return canReorientTarget();
67                }
68                return false;
69        }
70 
71        /**
72         * @generated
73         */
74        protected boolean canReorientSource() {
75                if (!(oldEnd instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour && newEnd instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour)) {
76                        return false;
77                }
78                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
79                                .canExistRecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviour_4004(
80                                                getNewSource(), getOldTarget());
81        }
82 
83        /**
84         * @generated
85         */
86        protected boolean canReorientTarget() {
87                if (!(oldEnd instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour && newEnd instanceof de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour)) {
88                        return false;
89                }
90                return PalladioComponentModelBaseItemSemanticEditPolicy.LinkConstraints
91                                .canExistRecoveryActionBehaviourFailureHandlingAlternatives__RecoveryActionBehaviour_4004(
92                                                getOldSource(), getNewTarget());
93        }
94 
95        /**
96         * @generated
97         */
98        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
99                        IAdaptable info) throws ExecutionException {
100                if (!canExecute()) {
101                        throw new ExecutionException(
102                                        "Invalid arguments in reorient link command"); //$NON-NLS-1$
103                }
104                if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
105                        return reorientSource();
106                }
107                if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
108                        return reorientTarget();
109                }
110                throw new IllegalStateException();
111        }
112 
113        /**
114         * @generated
115         */
116        protected CommandResult reorientSource() throws ExecutionException {
117                getOldSource()
118                                .getFailureHandlingAlternatives__RecoveryActionBehaviour()
119                                .remove(getOldTarget());
120                getNewSource()
121                                .getFailureHandlingAlternatives__RecoveryActionBehaviour().add(
122                                                getOldTarget());
123                return CommandResult.newOKCommandResult(referenceOwner);
124        }
125 
126        /**
127         * @generated
128         */
129        protected CommandResult reorientTarget() throws ExecutionException {
130                getOldSource()
131                                .getFailureHandlingAlternatives__RecoveryActionBehaviour()
132                                .remove(getOldTarget());
133                getOldSource()
134                                .getFailureHandlingAlternatives__RecoveryActionBehaviour().add(
135                                                getNewTarget());
136                return CommandResult.newOKCommandResult(referenceOwner);
137        }
138 
139        /**
140         * @generated
141         */
142        protected de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour getOldSource() {
143                return (de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) referenceOwner;
144        }
145 
146        /**
147         * @generated
148         */
149        protected de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour getNewSource() {
150                return (de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) newEnd;
151        }
152 
153        /**
154         * @generated
155         */
156        protected de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour getOldTarget() {
157                return (de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) oldEnd;
158        }
159 
160        /**
161         * @generated
162         */
163        protected de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour getNewTarget() {
164                return (de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour) newEnd;
165        }
166}

[all classes][de.uka.ipd.sdq.pcm.gmf.seff.edit.commands]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov