Package: ProtectedAreaBlockSpec

ProtectedAreaBlockSpec

nameinstructionbranchcomplexitylinemethod
ProtectedAreaBlockSpec()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
accept(Visitor)
M: 19 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
toString()
M: 38 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2009, 2012 Obeo.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * Obeo - initial API and implementation
10: *******************************************************************************/
11: package org.eclipse.acceleo.model.mtl.impl.spec;
12:
13: import org.eclipse.acceleo.model.mtl.InitSection;
14: import org.eclipse.acceleo.model.mtl.impl.ProtectedAreaBlockImpl;
15: import org.eclipse.ocl.parser.ValidationVisitor;
16: import org.eclipse.ocl.util.ToStringVisitor;
17:
18: /**
19: * Specializes the ProtectedAreaBlock implementation.
20: *
21: * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
22: */
23: public class ProtectedAreaBlockSpec extends ProtectedAreaBlockImpl {
24:         /**
25:          * {@inheritDoc}
26:          *
27:          * @see org.eclipse.ocl.ecore.impl.OCLExpressionImpl#accept(org.eclipse.ocl.utilities.Visitor)
28:          */
29:         @SuppressWarnings("unchecked")
30:         @Override
31:         public <T extends Object, U extends org.eclipse.ocl.utilities.Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(
32:                         U v) {
33:                 T result;
34:•                if (v instanceof ToStringVisitor<?, ?, ?, ?, ?, ?, ?, ?, ?>) {
35:                         result = (T)toString();
36:•                } else if (v instanceof ValidationVisitor<?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?>) {
37:                         result = (T)Boolean.TRUE;
38:                 } else {
39:                         result = super.accept(v);
40:                 }
41:                 return result;
42:         }
43:
44:         /**
45:          * {@inheritDoc}
46:          *
47:          * @see org.eclipse.ocl.ecore.impl.OCLExpressionImpl#toString()
48:          */
49:         @Override
50:         public String toString() {
51:                 final InitSection initSection = getInit();
52:
53:                 final StringBuilder toString = new StringBuilder("protected"); //$NON-NLS-1$
54:                 toString.append(' ').append('(');
55:                 toString.append(getMarker().toString());
56:                 toString.append(')');
57:•                if (initSection != null) {
58:                         toString.append(' ');
59:                         toString.append(initSection.toString());
60:                 }
61:                 return toString.toString();
62:         }
63: }