Skip to content

Package: DefinitionDefaultState

DefinitionDefaultState

nameinstructionbranchcomplexitylinemethod
DefinitionDefaultState()
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, TempVariableDefinition, Buffer, DefinitionFileParser)
M: 18 C: 29
62%
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.definitionstates;
2:
3: import model.RouterSoftware;
4: import model.definition.HasDefault;
5: import parser.DefinitionFileParser;
6: import parser.ParserException;
7: import parser.tempparserobjects.TempVariableDefinition;
8: import symbols.AbstractSymbol;
9: import symbols.StringSymbol;
10: import basic.Buffer;
11:
12: /**
13: *
14: * @author Muri
15: *
16: */
17: public class DefinitionDefaultState extends AbstractDefinitionState {
18:
19:         /**
20:          *
21:          * @param tVD
22:          * TempVariableDefinition
23:          * @param dFP
24:          * DefinitionFileParser
25:          * @param buffer
26:          * Buffer<Symbol>
27:          * @return
28:          * @throws InterruptedException
29:          * InterruptedException
30:          * @throws ParserException
31:          * ParserException
32:          */
33:         @Override
34:         public void parse(final RouterSoftware rs, final TempVariableDefinition tVD,
35:                         final Buffer<AbstractSymbol> buffer, final DefinitionFileParser dFP)
36:                         throws InterruptedException, ParserException {
37:                 final AbstractSymbol nextSymbol = buffer.peek();
38:•                if (nextSymbol instanceof StringSymbol) {
39:                         tVD.setDefaultValue(new HasDefault(((StringSymbol) nextSymbol).getText()));
40:                         tVD.setReady(true);
41:                         buffer.remove();
42:                         dFP.setState(new DefinitionInitialState());
43:                 } else {
44:                         throw new ParserException("no valid symbol: "
45:                                         + buffer.peek().getClass().getCanonicalName() + " expected StringSymbol");
46:                 }
47:         }
48: }