Skip to content

Package: ConditionState2

ConditionState2

nameinstructionbranchcomplexitylinemethod
ConditionState2(TempTypeExtensionWithCondition)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
parse(RouterSoftware, TempVariableType, Buffer, TypeFileParser)
M: 53 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%

Coverage

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