Package: DefinitionCommentState
DefinitionCommentState
| name | instruction | branch | complexity | line | method | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| DefinitionCommentState() | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
| parse(RouterSoftware, TempVariableDefinition, Buffer, DefinitionFileParser) | 
  | 
  | 
  | 
  | 
  | 
||||||||||||||||||||
Coverage
1: package parser.states.definitionstates;
2: 
3: import model.Comment;
4: import model.RouterSoftware;
5: import parser.DefinitionFileParser;
6: import parser.ParserException;
7: import parser.tempparserobjects.TempVariableDefinition;
8: import symbols.AbstractSymbol;
9: import symbols.CommentSymbol;
10: import basic.Buffer;
11: 
12: /**
13:  * 
14:  * @author Muri
15:  * 
16:  */
17: public class DefinitionCommentState 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 CommentSymbol) {
39:                         dFP.getComments()
40:                                         .add(new Comment(((CommentSymbol) nextSymbol).getText(), nextSymbol
41:                                                         .getPosition()));
42:                         dFP.setState(new DefinitionInitialState());
43:                         buffer.remove();
44:                 } else {
45:                         throw new ParserException("no valid symbol: "
46:                                         + buffer.peek().getClass().getCanonicalName() + " expected CommentSymbol");
47:                 }
48:         }
49: }