01: package de.regnis.q.sequence.line;
02:
03: import java.io.*;
04: import java.util.*;
05:
06: import de.regnis.q.sequence.line.simplifier.*;
07:
08: /**
09: * @author Marc Strapetz
10: */
11: final class QSequenceLineMemoryCache implements QSequenceLineCache {
12:
13: // Constants ==============================================================
14:
15: public static QSequenceLineMemoryCache read(InputStream is,
16: QSequenceLineSimplifier simplifier) throws IOException {
17: final QSequenceLineMemoryCache cache = new QSequenceLineMemoryCache();
18: final QSequenceLineReader reader = new QSequenceLineReader();
19: reader.read(is, cache, simplifier);
20: return cache;
21: }
22:
23: // Fields =================================================================
24:
25: private final List lines;
26:
27: // Setup ==================================================================
28:
29: public QSequenceLineMemoryCache() {
30: this .lines = new ArrayList();
31: }
32:
33: // Implemented ============================================================
34:
35: public void addLine(QSequenceLine line) {
36: lines.add(line);
37: }
38:
39: public int getLineCount() {
40: return lines.size();
41: }
42:
43: public int getLineHash(int index) {
44: return 0;
45: }
46:
47: public QSequenceLine getLine(int index) {
48: return (QSequenceLine) lines.get(index);
49: }
50:
51: public void close() {
52: }
53: }
|