|
4 | 4 | import de.monticore.scbasis._ast.ASTSCTransition; |
5 | 5 | import de.se_rwth.commons.logging.Log; |
6 | 6 |
|
7 | | -public class TransitionSourceTargetExists implements SCBasisASTSCTransitionCoCo{ |
8 | | - |
9 | | - public static final String SOURCE_ERROR_CODE = "0xCC103"; |
10 | | - public static final String TARGET_ERROR_CODE = "0xCC104"; |
11 | | - |
| 7 | +public class TransitionSourceTargetExists implements SCBasisASTSCTransitionCoCo { |
| 8 | + |
| 9 | + public static final String CANT_FIND_SOURCE_ERROR_CODE = "0xCC103"; |
| 10 | + public static final String CANT_FIND_TARGET_ERROR_CODE = "0xCC104"; |
| 11 | + |
| 12 | + public static final String CANT_FIND_SOURCE_ERROR_MSG = "Cannot resolve source state '%s'."; |
| 13 | + public static final String CANT_FIND_TARGET_ERROR_MSG = "Cannot resolve target state '%s'."; |
| 14 | + |
| 15 | + @Deprecated |
| 16 | + public static final String SOURCE_ERROR_CODE = CANT_FIND_SOURCE_ERROR_CODE; |
| 17 | + @Deprecated |
| 18 | + public static final String TARGET_ERROR_CODE = CANT_FIND_TARGET_ERROR_CODE; |
| 19 | + |
12 | 20 | @Override |
13 | 21 | public void check(ASTSCTransition node) { |
14 | | - |
| 22 | + |
15 | 23 | if (!node.isPresentSourceNameSymbol()) { |
16 | | - Log.error( |
17 | | - SOURCE_ERROR_CODE + " Source state of the transition is missing.", |
18 | | - node.get_SourcePositionStart()); |
| 24 | + Log.error(CANT_FIND_SOURCE_ERROR_CODE + " " + String.format(CANT_FIND_SOURCE_ERROR_MSG, node.getSourceName()), |
| 25 | + node.get_SourcePositionStart(), |
| 26 | + node.get_SourcePositionStart() |
| 27 | + ); |
19 | 28 | } |
20 | | - |
| 29 | + |
21 | 30 | if (!node.isPresentTargetNameSymbol()) { |
22 | | - Log.error( |
23 | | - TARGET_ERROR_CODE + " Target state of the transition is missing.", |
24 | | - node.get_SourcePositionStart()); |
| 31 | + Log.error(CANT_FIND_TARGET_ERROR_CODE + " " + String.format(CANT_FIND_TARGET_ERROR_MSG, node.getSourceName()), |
| 32 | + node.get_SourcePositionStart(), |
| 33 | + node.get_SourcePositionEnd() |
| 34 | + ); |
25 | 35 | } |
26 | 36 | } |
27 | | - |
28 | 37 | } |
0 commit comments