kinetic.util
Class Segmenter

java.lang.Object
  |
  +--kinetic.util.Segmenter
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LineSegmenter, WordSegmenter

public abstract class Segmenter
extends java.lang.Object
implements java.io.Serializable

abtract base class used to create custom segmenters that can hook into the framework for creating custom reusable animations

See Also:
Serialized Form

Field Summary
protected  javax.swing.text.StyledDocument document
          styled document of the text to be segmented
protected  int documentLength
          length of the text in the styled document
protected  int documentStart
          start position of the text in the styled docuemnt
protected  java.lang.String text
          text that will be segmented
 
Constructor Summary
Segmenter()
          Creates a new instance of Segmenter
Segmenter(kinetic.util.Segment seg)
          creates a new instance of the segmeter from a styled document that may contain attribute sets.
Segmenter(java.lang.String t)
          creates a new instance of the segmenter purely from a plain string
 
Method Summary
abstract  kinetic.util.Segment getNextSegment()
          return the next segment available from the segmenter
 boolean hasMoreSegements()
          checks to see if more segments are available
 void segmentSegment(kinetic.util.Segment seg)
          set sthe segment that will be segmented by this segmenter
abstract  void segmentText(java.lang.String t)
          sets the string to be segmented by this segmenter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

protected java.lang.String text
text that will be segmented


document

protected javax.swing.text.StyledDocument document
styled document of the text to be segmented


documentStart

protected int documentStart
start position of the text in the styled docuemnt


documentLength

protected int documentLength
length of the text in the styled document

Constructor Detail

Segmenter

public Segmenter()
Creates a new instance of Segmenter


Segmenter

public Segmenter(java.lang.String t)
creates a new instance of the segmenter purely from a plain string

Parameters:
t - text to be segmented

Segmenter

public Segmenter(kinetic.util.Segment seg)
creates a new instance of the segmeter from a styled document that may contain attribute sets.

Parameters:
seg - segment to tbe segmented
Method Detail

segmentText

public abstract void segmentText(java.lang.String t)
sets the string to be segmented by this segmenter

Parameters:
t - text to be segmented

segmentSegment

public void segmentSegment(kinetic.util.Segment seg)
set sthe segment that will be segmented by this segmenter

Parameters:
seg - segment to be segmented

getNextSegment

public abstract kinetic.util.Segment getNextSegment()
                                             throws java.util.NoSuchElementException
return the next segment available from the segmenter

Returns:
the next available segment
Throws:
java.util.NoSuchElementException - thrown if no more segments are available

hasMoreSegements

public boolean hasMoreSegements()
checks to see if more segments are available

Returns:
true if more segments are available, otherwise false