Skip to content

Package: TypeErrormessageState

TypeErrormessageState

nameinstructionbranchcomplexitylinemethod
TypeErrormessageState()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
parse(RouterSoftware, TempVariableType, Buffer, TypeFileParser)
M: 18 C: 26
59%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 7
78%
M: 0 C: 1
100%

Coverage

1: package parser.states.typestates;
2:
3: import basic.Buffer;
4: import model.RouterSoftware;
5: import parser.ParserException;
6: import parser.TypeFileParser;
7: import parser.tempparserobjects.TempVariableType;
8: import symbols.AbstractSymbol;
9: import symbols.StringSymbol;
10:
11: /**
12: *
13: * @author Muri
14: *
15: */
16: public class TypeErrormessageState extends AbstractTypeState {
17:
18:         /**
19:          *
20:          * @param tVT
21:          * tempVariableType
22:          * @param buffer
23:          * buffer
24:          * @param tFP
25:          * typeFileParser
26:          * @throws InterruptedException
27:          * InterruptedException
28:          * @throws ParserException
29:          * ParserException
30:          */
31:         @Override
32:         public void parse(final RouterSoftware rs, final TempVariableType tVT,
33:                         final Buffer<AbstractSymbol> buffer, final TypeFileParser tFP)
34:                         throws InterruptedException, ParserException {
35:                 final AbstractSymbol nextSymbol = buffer.peek();
36:•                if (nextSymbol instanceof StringSymbol) {
37:                         tVT.setErrorMessage(((StringSymbol) nextSymbol).getText());
38:                         buffer.remove();
39:                         tVT.setReady(true);
40:                         tFP.setState(new TypeInitialState());
41:                 } else {
42:                         throw new ParserException("no valid symbol: "
43:                                         + buffer.peek().getClass().getCanonicalName() + " expected StringSymbol");
44:                 }
45:         }
46: }