Skip to content

Package: SelectionState

SelectionState

nameinstructionbranchcomplexitylinemethod
SelectionState(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: 92
100%
M: 0 C: 12
100%
M: 0 C: 7
100%
M: 0 C: 19
100%
M: 0 C: 1
100%
finish(Buffer, String)
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: package scanner;
2:
3: import basic.Buffer;
4: import basic.PrinterConstants;
5: import symbols.AbstractSymbol;
6:
7: /**
8: * This class represents the SelectionState.
9: *
10: * @author HFW410
11: *
12: */
13: public class SelectionState extends AbstractState {
14:         /**
15:          * This constructor initialize the new TypeFileSelectionState.
16:          *
17:          * @param myScanner
18:          * is the used scanner.
19:          * @param beginningColumn
20:          * is the Begin Column of the Symbol
21:          * @param beginningRow
22:          * is the beginning row of the symbol
23:          */
24:         public SelectionState(final Scanner myScanner, final Integer beginningColumn,
25:                         final Integer beginningRow) {
26:                 super(myScanner, beginningColumn, beginningRow);
27:         }
28:
29:         @SuppressWarnings("deprecation")
30:         @Override
31:         public AbstractState action(final Character character,
32:                         final Buffer<AbstractSymbol> currentResult, final String dataPath) {
33:                 final AbstractState state;
34:•                if (Character.isSpace(character.charValue())) {
35:                         state = new WhitespaceState(this.getMyScanner(), this.getBeginningRow(),
36:                                         this.getBeginningRow());
37:•                } else if (Character.isLetter(character.charValue())
38:•                                && Character.isUpperCase(character.charValue())) {
39:                         state = new IdentifierState(this.getMyScanner(), this.getBeginningColumn(),
40:                                         this.getBeginningRow(), ScannerConstants.EMPTYSTRING);
41:•                } else if (character.equals(ScannerConstants.COMMENTSYMBOL)) {
42:                         this.getMyScanner().skip();
43:                         state = new CommentState(this.getMyScanner(), this.getBeginningColumn(),
44:                                         this.getBeginningRow());
45:•                } else if (character.equals(PrinterConstants.SINGLEQUOT.charAt(0))
46:•                                || character.equals(PrinterConstants.QUOTATIONMARK.charAt(0))) {
47:                         this.getMyScanner().skip();
48:                         state = new StringState(this.getMyScanner(), this.getBeginningColumn(),
49:                                         this.getBeginningRow(), character);
50:
51:                 } else {
52:                         state = this.getMyScanner().getRestState(this.getBeginningRow(),
53:                                         this.getBeginningColumn());
54:                 }
55:                 return state;
56:         }
57:
58:         @Override
59:         protected void finish(final Buffer<AbstractSymbol> currentResult, final String dataPath)
60:                         throws InterruptedException {
61:
62:         }
63: }