Skip to content

Package: CommentState

CommentState

nameinstructionbranchcomplexitylinemethod
CommentState(PackageDescriptionFileParser)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
action(RouterSoftware, PackageDescriptionFileSymbol)
M: 0 C: 37
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 7
100%
M: 0 C: 1
100%

Coverage

1: package parser.states.packagestates;
2:
3: import model.Comment;
4: import model.RouterSoftware;
5: import parser.PackageDescriptionFileParser;
6: import parser.ParserConstants;
7: import parser.ParserException;
8: import symbols.CommentSymbol;
9: import symbols.PackageDescriptionFileSymbol;
10:
11: /**
12: * This class represents the CommentState of the PackageDescriptionfileParser.
13: *
14: * @author Lisa Leitloff
15: *
16: */
17: public class CommentState extends AbstractPackageParserState {
18:         /**
19:          * constructor.
20:          *
21:          * @param parser
22:          * the PackageDescriptionfileParser.
23:          */
24:         public CommentState(final PackageDescriptionFileParser parser) {
25:                 super(parser);
26:         }
27:
28:         @Override
29:         public AbstractPackageParserState action(final RouterSoftware rs,
30:                         final PackageDescriptionFileSymbol symbol) throws InterruptedException,
31:                         ParserException {
32:                 final CommentSymbol commentSymbol = symbol.toCommentSymbol();
33:                 final Comment comment = new Comment(commentSymbol.getText(), commentSymbol.getPosition());
34:                 this.getMyParser().getComments().add(comment);
35:                 this.getMyParser().skip();
36:•                if (this.getMyParser().peekSymbol().isRowEndSymbol()) {
37:                         return new PackageDescriptionInitialState(this.getMyParser());
38:                 } else {
39:                         throw new ParserException(ParserConstants.COMMENT_FEHLER);
40:                 }
41:         }
42: }