Skip to contentMethod: DefinitionFileScanner(Buffer)
      1: package scanner;
2: 
3: import java.io.IOException;
4: import java.io.InputStream;
5: 
6: import symbols.AbstractSymbol;
7: import basic.Buffer;
8: 
9: /**
10:  * This class represents the DefinitionFileScanner.
11:  * 
12:  * @author HFW410
13:  * 
14:  */
15: public final class DefinitionFileScanner extends Scanner {
16:         /**
17:          * 
18:          * This constructor initialize the DefinitionFileScanner.
19:          * 
20:          * @param buffer
21:          *            is the Buffer of Symbols.
22:          */
23:         private DefinitionFileScanner(final Buffer<AbstractSymbol> buffer) {
24:                 super(buffer);
25:         }
26: 
27:         /**
28:          * creates a scanner and starts him.
29:          * 
30:          * @param input
31:          *            is the input stream.
32:          * @param dataPath
33:          *            is the path of the file.
34:          * @param buffer
35:          *            if the buffer for the symbols.
36:          * @throws IOException
37:          *             from the Input Stream.
38:          * @throws InterruptedException
39:          *             from the buffer.
40:          * @throws ScannerException
41:          *             if there is any problem during the scan.
42:          */
43:         public static void toSymbolSequence(final InputStream input, final String dataPath,
44:                         final Buffer<AbstractSymbol> buffer) throws ScannerException, InterruptedException,
45:                         IOException {
46:                 final DefinitionFileScanner scanner = new DefinitionFileScanner(buffer);
47:                 toSymbolSequence(input, dataPath, scanner);
48:         }
49: 
50:         @Override
51:         protected AbstractState getSelectionState() {
52:                 return new DefinitionFileSelectionState(this, this.getColumnCounter(),
53:                                 this.getRowCounter());
54:         }
55: 
56:         @Override
57:         protected AbstractState
58:                         getRestState(final Integer beginningRow, final Integer beginningColumn) {
59:                 return new DefinitionFileRestState(this, beginningColumn, beginningRow);
60:         }
61: 
62: }