Skip to content

Package: ConditionState1

ConditionState1

nameinstructionbranchcomplexitylinemethod
ConditionState1(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: 27 C: 32
54%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 6 C: 6
50%
M: 0 C: 1
100%
finish(Buffer, String)
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: *
3: */
4: package scanner;
5:
6: import basic.Buffer;
7: import basic.PrinterConstants;
8: import model.Position;
9: import symbols.AbstractSymbol;
10:
11: /**
12: * @author Hendrik
13: *
14: */
15: @SuppressWarnings("PMD.AvoidThreadGroup")
16: public class ConditionState1 extends AbstractState {
17:         /**
18:          * This constructor initialize the new ConditionState1.
19:          *
20:          * @param myScanner
21:          * is the used scanner.
22:          * @param beginningColumn
23:          * is the Begin Column of the Symbol
24:          * @param beginningRow
25:          * is the beginning row of the symbol
26:          */
27:         public ConditionState1(final Scanner myScanner, final Integer beginningColumn,
28:                         final Integer beginningRow) {
29:                 super(myScanner, beginningColumn, beginningRow);
30:         }
31:
32:         /*
33:          * (non-Javadoc)
34:          *
35:          * @see scanner.AbstractState#action(java.lang.Character, basic.Buffer, java.lang.String)
36:          */
37:         @Override
38:         public AbstractState action(final Character character,
39:                         final Buffer<AbstractSymbol> currentResult, final String dataPath)
40:                         throws InterruptedException {
41:                 final AbstractState state;
42:•                if (character.equals(PrinterConstants.QUOTATIONMARK.charAt(0))) {
43:                         this.getMyScanner().skip();
44:                         state = new Condition2State(getMyScanner(), this.getMyScanner().getColumnCounter(),
45:                                         getBeginningRow(), "");
46:
47:•                } else if (character.equals(PrinterConstants.SINGLEQUOT.charAt(0))) {
48:                         this.getMyScanner().skip();
49:                         state = new Condition1State(getMyScanner(), this.getMyScanner().getColumnCounter(),
50:                                         getBeginningRow(), "");
51:
52:                 } else {
53:                         this.finish(currentResult, dataPath);
54:                         this.getMyScanner().skip();
55:                         state = getMyScanner().getSelectionState();
56:
57:                 }
58:                 return state;
59:         }
60:
61:         /*
62:          * (non-Javadoc)
63:          *
64:          * @see scanner.AbstractState#finish(basic.Buffer, java.lang.String)
65:          */
66:         @Override
67:         protected void finish(final Buffer<AbstractSymbol> currentResult, final String dataPath)
68:                         throws InterruptedException {
69:                 currentResult.put(new symbols.UnknownSymbol("",
70:                                 new Position(getBeginningRow(), getBeginningColumn(), dataPath)));
71:
72:         }
73:
74: }