Skip to content

Package: Condition1State

Condition1State

nameinstructionbranchcomplexitylinemethod
Condition1State(Scanner, Integer, Integer, String)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
action(Character, Buffer, String)
M: 0 C: 45
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 9
100%
M: 0 C: 1
100%
finish(Buffer, String)
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

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