Skip to content

Package: WhitespaceState

WhitespaceState

nameinstructionbranchcomplexitylinemethod
WhitespaceState(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: 33
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 9
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 basic.Buffer;
4: import symbols.AbstractSymbol;
5:
6: /**
7: * This class represents the whitespaceState.
8: *
9: * @author HFW410
10: *
11: */
12: public class WhitespaceState extends AbstractState {
13:         /**
14:          * This is the constructor for a new WhitespaceState.
15:          *
16:          * @param myScanner
17:          * is the scanner.
18:          * @param beginningColumn
19:          * is the Begin Column of the whitespace
20:          * @param beginningRow
21:          * is the beginning row of the symbol
22:          */
23:         public WhitespaceState(final Scanner myScanner, final Integer beginningColumn,
24:                         final Integer beginningRow) {
25:                 super(myScanner, beginningColumn, beginningRow);
26:         }
27:
28:         @SuppressWarnings("deprecation")
29:         @Override
30:         public AbstractState action(final Character character,
31:                         final Buffer<AbstractSymbol> currentResult, final String dataPath) {
32:                 final AbstractState newState;
33:•                if (Character.isSpace(character)) {
34:•                        if (character.equals(ScannerConstants.NEWLINE)) {
35:                                 newState = new RowEndState(this.getMyScanner(),
36:                                                 this.getMyScanner().getColumnCounter(),
37:                                                 this.getMyScanner().getRowCounter());
38:                         } else {
39:                                 this.getMyScanner().skip();
40:                                 newState = this;
41:                         }
42:                 } else {
43:                         newState = this.getMyScanner().getSelectionState();
44:                 }
45:                 return newState;
46:         }
47:
48:         @Override
49:         protected void finish(final Buffer<AbstractSymbol> currentResult, final String dataPath) {
50:         }
51:
52: }