de.regnis.q.sequence.QSequenceSimpleLCS Maven / Gradle / Ivy
/*
* ====================================================================
* Copyright (c) 2000-2008 SyntEvo GmbH, [email protected]
* All rights reserved.
*
* This software is licensed as described in the file SEQUENCE-LICENSE,
* which you should have received as part of this distribution. Use is
* subject to license terms.
* ====================================================================
*/
package de.regnis.q.sequence;
import java.util.*;
import de.regnis.q.sequence.core.*;
/**
* @author Marc Strapetz
*/
public class QSequenceSimpleLCS implements QSequenceSnakeRegister {
// Fields =================================================================
private final QSequenceMedia media;
private final List commands = new ArrayList();
// Setup ==================================================================
public QSequenceSimpleLCS(QSequenceMedia media) {
this.media = media;
}
// Implemented ============================================================
public void registerSnake(int leftFrom, int leftTo, int rightFrom, int rightTo) {
commands.add(new QSequenceSimpleLCSCommand(true, leftFrom, leftTo));
}
// Accessing ==============================================================
public List getCommands() throws QSequenceException {
commands.clear();
final QSequenceAlgorithm algorithm = new QSequenceAlgorithm(media, this, Integer.MAX_VALUE);
algorithm.produceSnakesInOrder();
return commands;
}
}