Skip to content

Package: DefinitionFileRestState

DefinitionFileRestState

nameinstructionbranchcomplexitylinemethod
DefinitionFileRestState(Scanner, Integer, Integer)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
action(Character, Buffer, String)
M: 0 C: 56
100%
M: 0 C: 3
100%
M: 0 C: 3
100%
M: 0 C: 11
100%
M: 0 C: 1
100%
finish(Buffer, String)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: package scanner;
2:
3: import model.Position;
4: import symbols.AbstractSymbol;
5: import symbols.EmptySymbol;
6: import symbols.PlusSymbol;
7: import symbols.UnknownSymbol;
8: import basic.Buffer;
9:
10: /**
11: * This class represents the RestState for the DefinitionFileScanner.
12: *
13: * @author HFW410
14: *
15: */
16: public class DefinitionFileRestState extends AbstractState {
17:         /**
18:          * initialize the DefinitionFileRestState.
19:          *
20:          * @param myScanner
21:          * used Scanner
22:          * @param beginningColumn
23:          * the column where is the first character
24:          * @param beginningRow
25:          * is the row where is the first character
26:          */
27:         public DefinitionFileRestState(final Scanner myScanner, final Integer beginningColumn,
28:                         final Integer beginningRow) {
29:                 super(myScanner, beginningColumn, beginningRow);
30:         }
31:
32:         @Override
33:         public AbstractState action(final Character character,
34:                         final Buffer<AbstractSymbol> currentResult, final String dataPath)
35:                         throws InterruptedException {
36:•                switch (character) {
37:                 case '-':
38:                         currentResult.put(new EmptySymbol(new Position(this.getMyScanner().getRowCounter(),
39:                                         this.getBeginningColumn(), dataPath)));
40:                         break;
41:                 case '+':
42:                         currentResult.put(new PlusSymbol(new Position(this.getMyScanner().getRowCounter(),
43:                                         this.getBeginningColumn(), dataPath)));
44:                         break;
45:                 default:
46:                         currentResult.put(new UnknownSymbol(character.toString(), new Position(this
47:                                         .getMyScanner().getRowCounter(), this.getBeginningColumn(), dataPath)));
48:                         break;
49:                 }
50:                 this.getMyScanner().skip();
51:                 return this.getMyScanner().getSelectionState();
52:
53:         }
54:
55:         @Override
56:         protected void finish(final Buffer<AbstractSymbol> currentResult, final String dataPath) {
57:
58:         }
59:
60: }