/* Span1D.java * * Copyright (c) 1999-2001, Ted Nelson and Tuomas Lukka * * This file is part of Gzz. * * Gzz is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Gzz is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with Gzz; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * */ /* * Written by Tuomas Lukka */ package gzz.media; import gzz.errors.*; /** A 1-dimensional span inside one document. * The different routines use "natural units" the definition * of which depends on the span type - see the appropriate subinterfaces. * IMMUTABLE */ public interface Span1D extends Span { String rcsid = "$Id: Span1D.java,v 1.1 2003/03/25 12:21:36 tjl Exp $"; /** Get the offset of this span inside the Mediaserver block, * in natural units starting at zero. */ int offset(); /** Get the length of this span, in natural units. */ int length(); /** Return the subSpan starting at o1 in natural units * and ending just before o2, * analogous to java.lang.String.substring(). */ Span1D subSpan(int o1, int o2); /** Return the subSpan starting at o1 in natural units * and ending at the end * of this span, * analogous to java.lang.String.substring(). */ Span1D subSpan(int o1); /** Get the start of the given subspan, relative to the start of this. * subspan must be wholly contained in this span; otherwise, an error * is thrown. */ int getRelativeStart(Span1D subspan); /** Get the end of the given subspan, relative to the start of this. * subspan must be wholly contained in this span; otherwise, an error * is thrown. */ int getRelativeEnd(Span1D subspan); /** Return the span that results from appending the other span * to this span, if the resulting span is contiguous. * Otherwise, returns null. */ Span1D append(Span s); }