Skip to content

Package: AssignmentCommentState

AssignmentCommentState

nameinstructionbranchcomplexitylinemethod
AssignmentCommentState()
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(RouterConfiguration, TempVariableAssignment, Buffer, AssignmentFileParser)
M: 18 C: 29
62%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 8
80%
M: 0 C: 1
100%

Coverage

1: package parser.states.assignmentstates;
2:
3: import model.Comment;
4: import model.RouterConfiguration;
5: import parser.AssignmentFileParser;
6: import parser.ParserException;
7: import parser.tempparserobjects.TempVariableAssignment;
8: import symbols.AbstractSymbol;
9: import symbols.CommentSymbol;
10: import basic.Buffer;
11:
12: /**
13: *
14: * @author Muri
15: *
16: */
17: public class AssignmentCommentState extends AbstractAssignmentState {
18:
19:         /**
20:          *
21:          * @param tVA
22:          * TempVariableAssignment
23:          * @param buffer
24:          * Buffer<Symbol>
25:          * @param aFP
26:          * AssignmentFileParser
27:          * @throws InterruptedException
28:          * InterruptedException
29:          * @throws ParserException
30:          * ParserException
31:          * @return
32:          */
33:         @Override
34:         public void parse(final RouterConfiguration rc, final TempVariableAssignment tVA,
35:                         final Buffer<AbstractSymbol> buffer, final AssignmentFileParser aFP)
36:                         throws InterruptedException, ParserException {
37:                 final AbstractSymbol nextSymbol = buffer.peek();
38:•                if (nextSymbol instanceof CommentSymbol) {
39:                         aFP.getComments()
40:                                         .add(new Comment(((CommentSymbol) nextSymbol).getText(), nextSymbol
41:                                                         .getPosition()));
42:                         aFP.setState(new AssignmentInitialState());
43:                         buffer.remove();
44:                 } else {
45:                         throw new ParserException("no valid symbol: "
46:                                         + buffer.peek().getClass().getCanonicalName() + " expected CommentSymbol");
47:                 }
48:         }
49: }