diff --git a/java/src/org/broadinstitute/sting/utils/windowmaker/PositionalDataGenerator.java b/java/src/org/broadinstitute/sting/utils/windowmaker/PositionalDataGenerator.java new file mode 100755 index 000000000..37c3e46ae --- /dev/null +++ b/java/src/org/broadinstitute/sting/utils/windowmaker/PositionalDataGenerator.java @@ -0,0 +1,17 @@ +package org.broadinstitute.sting.utils.windowmaker; + +import org.broadinstitute.sting.utils.GenomeLoc; +import org.broadinstitute.sting.utils.Pair; + +import java.util.Iterator; + +/** + * Created by IntelliJ IDEA. + * User: depristo + * Date: Apr 14, 2009 + * Time: 9:33:00 AM + * To change this template use File | Settings | File Templates. + */ +public interface PositionalDataGenerator { + public Pos lastPos(); +} \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/utils/windowmaker/WindowMaker.java b/java/src/org/broadinstitute/sting/utils/windowmaker/WindowMaker.java new file mode 100755 index 000000000..a10457dae --- /dev/null +++ b/java/src/org/broadinstitute/sting/utils/windowmaker/WindowMaker.java @@ -0,0 +1,85 @@ +package org.broadinstitute.sting.utils.windowmaker; + +import org.broadinstitute.sting.utils.Pair; + +import java.util.ArrayList; + +/** + * System for allowing "windowed" access into a data stream + * + * User: depristo + * Date: May 1, 2009 + * Time: 3:03:20 PM + * To change this template use File | Settings | File Templates. + */ +public abstract class WindowMaker { + private PositionalDataGenerator dataSource; + + public WindowMaker(PositionalDataGenerator pdg) + { + dataSource = pdg; + } + + /** + * + */ + public abstract boolean hasNext(); + + /** + * Get the next object in the stream. Does not advance the stream pointer. Successive peek() + * calls return the same object. + * + * @return + */ + public abstract Pair peek(); + + /** + * Return the next N objects in the stream. Does not advance the stream pointer. Successive peek() + * calls return the same Array of Objects. + * + * @param N + * @return + */ + public abstract ArrayList> peek(int N); + + /** + * Pop the leftmost object off the window + */ + public abstract void pop(); + + /** + * Pop the leftmost N objects off the window + * @param N + */ + public abstract void pop(int N); + + /** + * Advance the internal stream pointer to from, collect all data until to, and return the data + * from -> to as an ArrayList + * + * @param from + * @param to + * @return + */ + public abstract ArrayList> speek(Pos from, Pos to); + + /** + * Advance the internal stream pointer to from, collect N data units, and return the data + * as an ArrayList + * + * @param from + * @param length + * @return + */ + public abstract ArrayList> speek(Pos from, int N); + + + /** + * Advance the internal stream pointer to from, collect all remaining data units from the + * data stream, and return them all as one (potentially large) arraylist + * + * @param from + * @return + */ + public abstract ArrayList> speek(Pos from); +}