gzz.media
Interface Enfilade1D

gzz.media.Span gzz.media.Enfilade1D gzz.media.Span1D gzz.media.TextSpan gzz.media.ImageSpan gzz.media.PageSpan gzz.media.VideoSpan gzz.media.AudioSpan gzz.media.ScrollBlock ../../../Gzz_CoreAPIs.gen.html#media media_small
All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
Enfilade1DImpl

public interface Enfilade1D
extends java.io.Serializable

A sequence of 1D spans (assumed to be the same type, but not enforced) that can be operated on as a string for cuttings.

2D (image) or 3D (video/page) spans can be included in the streams: those which do not extend Span1D they are interpreted as single characters by this class, but those that do are interpreted as text of their length. In the text string, they are represented by the character (XXX? Not sure yet). The Iterator returned by the iterator() method will iterate over those spans normally.

NOTE: THIS IS AN IMMUTABLE CLASS: NEW OBJECTS ARE CREATED BY THE OPERATIONS. A tree implementation should be able to share nodes and thus perform operations with log(L) efficiency.


Nested Class Summary
static interface Enfilade1D.Maker
           
 
Field Summary
static java.lang.String rcsid
           
 
Method Summary
 java.util.List getList()
          Get a List of the spans in this enfilade.
 Enfilade1D.Maker getMaker()
           
 int length()
          Get the sum of the lengths.
 java.lang.String makeString()
          Return a String object where offsets are the same as in this enfilade.
 Enfilade1D optimized()
          Return a possibly optimized version of this enfilade.
 Enfilade1D plus(Enfilade1D other)
          Return an Enfilade1D object whose vstream is a concatenation of this enfilade and the other one given.
 Enfilade1D plus(Span1D other)
          Return an Enfilade1D object whose vstream is a concatenation of this enfilade and the span given.
 Enfilade1D prepended(Span1D other)
          Return an Enfilade1D object whose vstream is a concatenation of the given span and this enfilade.
 Enfilade1D sub(int o1)
           
 Enfilade1D sub(int o1, int o2)
           
 

Field Detail

rcsid

public static final java.lang.String rcsid
See Also:
Constant Field Values
Method Detail

getMaker

public Enfilade1D.Maker getMaker()

length

public int length()
Get the sum of the lengths. This MUST be the same as the length of the string returned by makeString().


sub

public Enfilade1D sub(int o1)

sub

public Enfilade1D sub(int o1,
                      int o2)

plus

public Enfilade1D plus(Enfilade1D other)
Return an Enfilade1D object whose vstream is a concatenation of this enfilade and the other one given. Unless the enfilades were created by the same maker, this method may throw a classcastexception.


plus

public Enfilade1D plus(Span1D other)
Return an Enfilade1D object whose vstream is a concatenation of this enfilade and the span given. Unless the enfilades were created by the same maker, this method may throw a classcastexception.


prepended

public Enfilade1D prepended(Span1D other)
Return an Enfilade1D object whose vstream is a concatenation of the given span and this enfilade. Unless the enfilades were created by the same maker, this method may throw a classcastexception.


makeString

public java.lang.String makeString()
Return a String object where offsets are the same as in this enfilade. Note that having an audio span will put in a lot of dummy chars so don't do that ;)

This is not toString() because that routine will give a string which explicitly indicates that this is an enfilade, and also gives the permanent ids of the spans therein.


getList

public java.util.List getList()
Get a List of the spans in this enfilade.


optimized

public Enfilade1D optimized()
Return a possibly optimized version of this enfilade. This could e.g. balance a tree. This function may be relatively expensive in terms of time, and also may reduce the number of nodes that can be shared between enfilades.

It is at its most useful for enfilades that have been created by adding little by little to the end, and which are not shared. Of course, most text entered in cells *is* just like that...

This method must at least join spans which are next to each other and which are contiguous (the latter can be appended to the former). This is necessary because coniguous spans MUST be appended before saving, otherwise we'd generate lots of JUNK!

Invariants which implementations MUST obey: ( XXX too harsh? )