01: package de.regnis.q.sequence.media;
02:
03: import de.regnis.q.sequence.core.*;
04:
05: /**
06: * @author Marc Strapetz
07: */
08: public abstract class QSequenceIntMedia implements QSequenceMedia,
09: QSequenceMediaComparer {
10:
11: // Abstract ===============================================================
12:
13: public abstract int getSymbolCount();
14:
15: public abstract int[] getLeftSymbols();
16:
17: public abstract int[] getRightSymbols();
18:
19: // Fields =================================================================
20:
21: private final QSequenceCanceller canceller;
22:
23: // Setup ==================================================================
24:
25: protected QSequenceIntMedia(QSequenceCanceller canceller) {
26: this .canceller = canceller;
27: }
28:
29: // Implemented ============================================================
30:
31: public final boolean equalsLeft(int left1, int left2)
32: throws QSequenceCancelledException {
33: checkCancelled();
34: return getLeftSymbols()[left1] == getLeftSymbols()[left2];
35: }
36:
37: public final boolean equalsRight(int right1, int right2)
38: throws QSequenceCancelledException {
39: checkCancelled();
40: return getRightSymbols()[right1] == getRightSymbols()[right2];
41: }
42:
43: // Accessing ==============================================================
44:
45: public final void checkCancelled()
46: throws QSequenceCancelledException {
47: canceller.checkCancelled();
48: }
49: }
|