edu.ucsb.nmsl.tools
Class Transcript.TranscriptIterator

java.lang.Object
  extended by edu.ucsb.nmsl.tools.Transcript.TranscriptIterator
All Implemented Interfaces:
java.util.Iterator, java.util.ListIterator
Enclosing class:
Transcript

protected class Transcript.TranscriptIterator
extends java.lang.Object
implements java.util.ListIterator

The responsibility of this inner class is to provide an iterator interface to the transcript class for the purpose of breaking a transcript into its individual chunks. These interators operate both forwards and backwards and across each individual segement of the transcript. The main purpose of this class is to allow the estimation process to count words between words that were recognized during the recognition phase and those that were not.

Version:
1.0

Field Summary
protected static int BACKWARD
          Indicates the iterator is currently moving backwards.
protected  java.util.ListIterator currCaption
           
protected  java.util.ListIterator currWord
           
protected  int Direction
          Indicates the current direction of the iterator as indicated by the last call to either previous() or next().
protected static int FORWARD
          Indicates the iterator is currently moving forward.
protected  int Index
          Index of the current word in the current segment in the transcript.
 
Constructor Summary
Transcript.TranscriptIterator(java.util.ListIterator i, int index)
          This constructor creates a new instances of the Transcript iterator from a ListIterator instance and the index of the current chunk in the list.
 
Method Summary
 void add(java.lang.Object o)
          This method add a chunk at the current index within the transcript.
 boolean hasNext()
          This method determines whether another caption chunk exists if a subsequent call to next() is made.
 boolean hasPrevious()
          This method determines whether another caption chunk exists if a subsequent call to previous() is made.
 java.lang.Object next()
          This method returns the next transcript chunk if one exists.
protected  void nextCaptionWord()
          This method is a helper function that moves the current transcript segment forward to the next segment.
 int nextIndex()
          This method returns the index of the transcript chunk for the next call to the next() method.
 java.lang.Object previous()
          This method returns the previous transcript chunk if one exists.
protected  void previousCaptionWord()
          This method is a helper function that moves the current transcript segment backward to the previous segment.
 int previousIndex()
          This method returns the index of the transcript chunk for the next call to the previous() method.
 void remove()
          This method removes a chunk at the current index within the transcript.
 void set(java.lang.Object o)
          This method sets a chunk at the current index within the transcript to the value passed into the method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Index

protected int Index
Index of the current word in the current segment in the transcript.


BACKWARD

protected static final int BACKWARD
Indicates the iterator is currently moving backwards.

See Also:
Constant Field Values

FORWARD

protected static final int FORWARD
Indicates the iterator is currently moving forward.

See Also:
Constant Field Values

Direction

protected int Direction
Indicates the current direction of the iterator as indicated by the last call to either previous() or next().


currCaption

protected java.util.ListIterator currCaption

currWord

protected java.util.ListIterator currWord
Constructor Detail

Transcript.TranscriptIterator

public Transcript.TranscriptIterator(java.util.ListIterator i,
                                     int index)
This constructor creates a new instances of the Transcript iterator from a ListIterator instance and the index of the current chunk in the list. The ListIterator points to a segment with in the transcript and index indicates which word within that segemtn to start from whcn calling previous() and next().

Parameters:
i - - The ListIterator that points to the current segment in the Transcript, offset by "index" words.
index - - The index of the current word within the segment passed as i.
Method Detail

next

public java.lang.Object next()
This method returns the next transcript chunk if one exists. If there are no more chunks left within the current segment, theb the first word of the next segment is returned. The end of the transcript has been reached if no more segments exist.

Specified by:
next in interface java.util.Iterator
Specified by:
next in interface java.util.ListIterator
Returns:
The next caption chunk in the transcript.

previous

public java.lang.Object previous()
This method returns the previous transcript chunk if one exists. If there are no more chunks left within the current segment, then the last chunk of the previous segment is returned. The beginning of the transcript has been reached if no more segments exist.

Specified by:
previous in interface java.util.ListIterator
Returns:
The previous caption chunk in the transcript.

nextIndex

public int nextIndex()
This method returns the index of the transcript chunk for the next call to the next() method. This index represents the position of the chunk within the entire transcript. For example, if the index 3 is returned, then the next caption chunk is the 4th chunk, as the indices start from zero.

Specified by:
nextIndex in interface java.util.ListIterator
Returns:
The index of the caption chunk for the next call to next().

previousIndex

public int previousIndex()
This method returns the index of the transcript chunk for the next call to the previous() method. This index represents the position of the chunk within the entire transcript. For example, if the index 3 is returned, then the next caption chunk is the 4th chunk, as the indices start from zero.

Specified by:
previousIndex in interface java.util.ListIterator
Returns:
The index of the caption chunk for the next call to previous().

hasNext

public boolean hasNext()
This method determines whether another caption chunk exists if a subsequent call to next() is made.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface java.util.ListIterator
Returns:
True if there is a next caption chunk, false otherwise.
See Also:
next().

hasPrevious

public boolean hasPrevious()
This method determines whether another caption chunk exists if a subsequent call to previous() is made.

Specified by:
hasPrevious in interface java.util.ListIterator
Returns:
True if there is a previous caption chunk, false otherwise.
See Also:
previous().

add

public void add(java.lang.Object o)
This method add a chunk at the current index within the transcript.

Specified by:
add in interface java.util.ListIterator
Parameters:
o - - The caption chunk to be inserted into the transcript.

remove

public void remove()
This method removes a chunk at the current index within the transcript.

Specified by:
remove in interface java.util.Iterator
Specified by:
remove in interface java.util.ListIterator

set

public void set(java.lang.Object o)
This method sets a chunk at the current index within the transcript to the value passed into the method.

Specified by:
set in interface java.util.ListIterator
Parameters:
o - - The caption chunk to be set at the current location.

nextCaptionWord

protected void nextCaptionWord()
This method is a helper function that moves the current transcript segment forward to the next segment. It is called when the last word of the previous transcript segment was reached.


previousCaptionWord

protected void previousCaptionWord()
This method is a helper function that moves the current transcript segment backward to the previous segment. It is called when the first word of the next transcript segment was reached.