Skip to content

Package: TypeVariableState

TypeVariableState

nameinstructionbranchcomplexitylinemethod
TypeVariableState(AbstractSymbol, TempTypeExtensionWithCondition)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getVariable()
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%
parse(RouterSoftware, TempVariableType, Buffer, TypeFileParser)
M: 35 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: *
3: */
4: package parser.states.typestates;
5:
6: import model.RouterSoftware;
7: import parser.ParserException;
8: import parser.TypeFileParser;
9: import parser.tempparserobjects.TempTypeExtensionWithCondition;
10: import parser.tempparserobjects.TempVariableType;
11: import symbols.AbstractSymbol;
12: import symbols.IdentifierSymbol;
13: import basic.Buffer;
14:
15: /**
16: * @author Hendrik
17: *
18: */
19: public class TypeVariableState extends AbstractTypeState {
20:         /**
21:          * The Variable.
22:          */
23:         private final AbstractSymbol variable;
24:         /**
25:          * the identifierSymbol.
26:          */
27:         private final TempTypeExtensionWithCondition tempExt;
28:
29:         /**
30:          * The constructor.
31:          *
32:          * @param variable
33:          * the variable of the last state.
34:          * @param tempExt
35:          * the identifierSymbol of the line;
36:          */
37:         protected TypeVariableState(final AbstractSymbol variable,
38:                         final TempTypeExtensionWithCondition tempExt) {
39:                 super();
40:                 this.variable = variable;
41:                 this.tempExt = tempExt;
42:
43:         }
44:
45:         /*
46:          * (non-Javadoc)
47:          *
48:          * @see
49:          * parser.states.typestates.AbstractTypeState#parse(parser.tempparserobjects.TempVariableType,
50:          * basic.Buffer, parser.TypeFileParser)
51:          */
52:         @Override
53:         public void parse(final RouterSoftware rs, final TempVariableType tVT,
54:                         final Buffer<AbstractSymbol> buffer, final TypeFileParser tFP)
55:                         throws InterruptedException, ParserException {
56:                 final AbstractSymbol nextSymbol = buffer.peek();
57:•                if (nextSymbol instanceof IdentifierSymbol) {
58:                         tFP.setState(new VariableState(nextSymbol, this.tempExt));
59:                 } else {
60:                         throw new ParserException("no valid symbol: "
61:                                         + buffer.peek().getClass().getCanonicalName()
62:                                         + " expected BracketCloseSymbol or IdentifierSymbol");
63:                 }
64:
65:         }
66:
67:         /**
68:          * @return the variable
69:          */
70:         public AbstractSymbol getVariable() {
71:                 return this.variable;
72:         }
73: }