Skip to main content
summaryrefslogtreecommitdiffstats
blob: 320c952eea3bb9530fecdb62a97a581fd59fffa4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*****************************************************************************
 * Copyright (c) 2010 CEA LIST.
 *
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  CEA LIST - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.marte.vsl.validation;

import java.util.List;

public class VSLErrorMessage {

	public static String getUndefinedBinaryOperatorSignatureMessage(
			String operatorSymbol, String firstOperandTypeName, String secondOperandTypeName) {
		return "Operator "
				+ operatorSymbol
				+ " is undefined for signature ("
				+ firstOperandTypeName
				+ ", "
				+ secondOperandTypeName
				+ ")";
	}

	public static String getUndefinedUnaryOperatorSignatureMessage(String operatorSymbol,
			String operandTypeName) {
		return "Unary operator "
				+ operatorSymbol
				+ " does not apply to type "
				+ operandTypeName;
	}

	public static String getUntypedPropertyMessage(String propertyName) {
		return "Property " + propertyName + " is not typed";
	}

	public static String getMissingArgumentForChosenAlternativeMessage(String chosenAlternativeName,
			String expectedTypeName) {
		return "Argument is missing for the chosen alternative "
				+ chosenAlternativeName
				+ ". Expecting a single argument of type "
				+ expectedTypeName;
	}

	public static String getTooManyArgumentsForChosenAlternativeMessage(String chosenAlternativeName,
			String expectedTypeName) {
		return "Too many arguments for the chosen alternative "
				+ chosenAlternativeName
				+ ". Expecting a single argument of type "
				+ expectedTypeName;
	}

	public static String getInvalidArgumentForChosenAlternativeMessage(String chosenAlternativeName,
			String expectedTypeName, String foundTypeName) {
		return "Invalid argument for the chosen alternative "
				+ chosenAlternativeName
				+ ". Found an argument of type "
				+ foundTypeName
				+ ". Expecting a single argument of type "
				+ expectedTypeName;
	}

	public static String getBehaviorWithoutReturnParameterMessage(String behaviorName) {
		return "Behavior "
				+ behaviorName
				+ " has no return parameter";
	}

	public static String getOperationWithoutReturnParameterMessage(String operationName) {
		return "Operation "
				+ operationName
				+ " has no return parameter";
	}

	public static String getMissingArgumentsForBehaviorCall(String behaviorName, List<String> expectedTypeNames) {
		String errorMessage = "Arguments are missing for the call to behavior ";
		errorMessage += behaviorName + "(";
		for (int i = 0; i < expectedTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += expectedTypeNames.get(i);
		}
		errorMessage += ")";
		return errorMessage;
	}

	public static String getInvalidNumberOfArgumentsForBehaviorCall(String behaviorName, List<String> expectedTypeNames) {
		String errorMessage = "Invalid number of arguments for the call to behavior ";
		errorMessage += behaviorName + "(";
		for (int i = 0; i < expectedTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += expectedTypeNames.get(i);
		}
		errorMessage += ")";
		return errorMessage;
	}

	public static String getInvalidNumberOfArgumentsForOperationCall(String operationName, List<String> expectedTypeNames) {
		String errorMessage = "Invalid number of arguments for the call to operation ";
		errorMessage += operationName + "(";
		for (int i = 0; i < expectedTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += expectedTypeNames.get(i);
		}
		errorMessage += ")";
		return errorMessage;
	}

	public static String getInvalidArgumentsForBehaviorCall(String behaviorName,
			List<String> expectedTypeNames, List<String> foundTypeNames) {
		String errorMessage = "The behavior ";
		errorMessage += behaviorName + "(";
		for (int i = 0; i < expectedTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += expectedTypeNames.get(i);
		}
		errorMessage += ") is not applicable for the arguments (";
		for (int i = 0; i < foundTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += foundTypeNames.get(i);
		}
		errorMessage += ")";
		return errorMessage;
	}

	public static String getInvalidArgumentsForOperationCall(String operationName,
			List<String> expectedTypeNames, List<String> foundTypeNames) {
		String errorMessage = "The operation ";
		errorMessage += operationName + "(";
		for (int i = 0; i < expectedTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += expectedTypeNames.get(i);
		}
		errorMessage += ") is not applicable for the arguments (";
		for (int i = 0; i < foundTypeNames.size(); i++) {
			if (i >= 1) {
				errorMessage += ", ";
			}
			errorMessage += foundTypeNames.get(i);
		}
		errorMessage += ")";
		return errorMessage;
	}

	public static String getInvalidNumberOfExpressionsInConditionalExpression() {
		return "Invalid conditional expression. The correct syntax is: <CONDITION> ? <THEN EXPRESSION> : <ELSE EXPRESSION>";
	}

	public static String getInvalidExpressionType(String expectedTypeName, String foundTypeName) {
		return "Expecting an expression of type " + expectedTypeName + ". Found an expression of type " + foundTypeName;
	}
}

Back to the top