de.regnis.q.sequence.core.QSequenceDeePathExtenderArray Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sequence-library Show documentation
Show all versions of sequence-library Show documentation
Textual Diff and Merge Library
/*
* ====================================================================
* 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.core;
/**
* @author Marc Strapetz
*/
class QSequenceDeePathExtenderArray {
// Fields =================================================================
private final int[] xs;
private final int offset;
private int delta;
// Setup ==================================================================
public QSequenceDeePathExtenderArray(int maximumMediaLeftRightLength) {
this.offset = maximumMediaLeftRightLength;
this.xs = new int[2 * maximumMediaLeftRightLength + 1];
}
// Accessing ==============================================================
public void set(int diagonal, int maxLeft) {
if (QSequenceAlgorithm.ASSERTIONS) {
QSequenceAssert.assertTrue(-offset + delta <= diagonal && diagonal <= offset + delta);
}
this.xs[offset - delta + diagonal] = maxLeft;
}
public int get(int diagonal) {
if (QSequenceAlgorithm.ASSERTIONS) {
QSequenceAssert.assertTrue(-offset + delta <= diagonal && diagonal <= offset + delta);
}
final int left = xs[offset - delta + diagonal];
if (QSequenceAlgorithm.ASSERTIONS) {
QSequenceAssert.assertTrue(left != Integer.MAX_VALUE);
}
return left;
}
public void setDelta(int delta) {
this.delta = delta;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy