01: /*
02: * ====================================================================
03: * Copyright (c) 2004 Marc Strapetz, marc.strapetz@smartsvn.com.
04: * All rights reserved.
05: *
06: * This software is licensed as described in the file COPYING, which
07: * you should have received as part of this distribution. Use is
08: * subject to license terms.
09: * ====================================================================
10: */
11:
12: package de.regnis.q.sequence;
13:
14: import java.util.*;
15:
16: import de.regnis.q.sequence.core.*;
17:
18: /**
19: * @author Marc Strapetz
20: */
21: public class QSequenceSimpleLCS implements QSequenceSnakeRegister {
22:
23: // Fields =================================================================
24:
25: private final QSequenceMedia media;
26: private final List commands = new ArrayList();
27:
28: // Setup ==================================================================
29:
30: public QSequenceSimpleLCS(QSequenceMedia media) {
31: this .media = media;
32: }
33:
34: // Implemented ============================================================
35:
36: public void registerSnake(int leftFrom, int leftTo, int rightFrom,
37: int rightTo) {
38: commands.add(new QSequenceSimpleLCSCommand(true, leftFrom,
39: leftTo));
40: }
41:
42: // Accessing ==============================================================
43:
44: public List getCommands() throws QSequenceException {
45: commands.clear();
46: final QSequenceAlgorithm algorithm = new QSequenceAlgorithm(
47: media, this, Integer.MAX_VALUE);
48: algorithm.produceSnakesInOrder();
49: return commands;
50: }
51: }
|