kinetic.util
Class Segment

java.lang.Object
  |
  +--kinetic.util.Segment
All Implemented Interfaces:
java.io.Serializable

public class Segment
extends java.lang.Object
implements java.io.Serializable

A segment of text bundled with timing infromation and optional attributes which composite effects can respond to.

See Also:
Serialized Form

Field Summary
protected  javax.swing.text.AttributeSet attributes
          set of attributes for this segment of text
protected  javax.swing.text.StyledDocument document
          a styled document containing decorated text
protected  int documentLength
          length of this segment of text in the styled document
protected  int documentStart
          starting position of this segment of text in the style document
 double leadIn
          lead in time for this segment of text
 double leadOut
          lead out time for this segment of text
 double runTime
          run time or sustain of this segment of text
 java.lang.String text
          content of the segment in string format
 
Constructor Summary
Segment()
          creates a new isntance of a segment
Segment(double in, double run, double out, java.lang.String s)
          creates new instance of a segment with the given timing and text information
Segment(double in, double run, double out, java.lang.String s, javax.swing.text.StyledDocument d, int start)
          creates new instance of a segment with the given timing and text information and adopts the attributes fro the specifed position the styled document
Segment(javax.swing.text.StyledDocument d, int start, int length)
          creates new instance of a segment with the specifed text the styled document
 
Method Summary
 javax.swing.text.StyledDocument getDocument()
          gets the styled document associated with this segment
 int getDocumentLength()
          gets the length of the segment in the styled document
 int getDocumentStart()
          gets the start position in the styled document associated with this segment
 double getDuration()
          gets the full duration of the segment
 java.awt.Font getFont()
          gets the font associated with the segment if available
 java.awt.Color getForground()
          gets the color associated with the segment if available
 double getLeadIn()
          gets the lead in or attack time of the segment
 double getLeadOut()
          gets the lead out or decay time of the segment
 double getRunTime()
          gets the run/sustain time of the segment
 java.lang.String getText()
          get the text of the segment in string format
 boolean hasTag(java.lang.String tagName)
          queries if this segment has a particular attribute associated with it
 void setDocument(javax.swing.text.StyledDocument d)
          sets the styled document associated with this segment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

document

protected javax.swing.text.StyledDocument document
a styled document containing decorated text


attributes

protected javax.swing.text.AttributeSet attributes
set of attributes for this segment of text


documentStart

protected int documentStart
starting position of this segment of text in the style document


documentLength

protected int documentLength
length of this segment of text in the styled document


leadIn

public double leadIn
lead in time for this segment of text


leadOut

public double leadOut
lead out time for this segment of text


runTime

public double runTime
run time or sustain of this segment of text


text

public java.lang.String text
content of the segment in string format

Constructor Detail

Segment

public Segment()
creates a new isntance of a segment


Segment

public Segment(double in,
               double run,
               double out,
               java.lang.String s)
creates new instance of a segment with the given timing and text information

Parameters:
in - attack/lead in time in ms
run - sustain time in ms
out - decay/lead out time in ms
s - text in the segment

Segment

public Segment(double in,
               double run,
               double out,
               java.lang.String s,
               javax.swing.text.StyledDocument d,
               int start)
creates new instance of a segment with the given timing and text information and adopts the attributes fro the specifed position the styled document

Parameters:
in - attack/lead in time in ms
run - sustain time in ms
out - decay/lead out time in ms
s - text in the segment
d - styled document contained attribute information
start - position in the styled document for attributes

Segment

public Segment(javax.swing.text.StyledDocument d,
               int start,
               int length)
creates new instance of a segment with the specifed text the styled document

Parameters:
d - styled document contained attribute information
start - position in the styled document for attributes
length - of the text in the styled document
Method Detail

getText

public java.lang.String getText()
get the text of the segment in string format

Returns:
text of the segment

getDuration

public double getDuration()
gets the full duration of the segment

Returns:
duration of the segment (ms)

getRunTime

public double getRunTime()
gets the run/sustain time of the segment

Returns:
run time of the segment (ms)

getLeadIn

public double getLeadIn()
gets the lead in or attack time of the segment

Returns:
lead in time of the segment (ms)

getLeadOut

public double getLeadOut()
gets the lead out or decay time of the segment

Returns:
lead out time of the segment (ms)

getFont

public java.awt.Font getFont()
gets the font associated with the segment if available

Returns:
null if no font is associated with segment

getForground

public java.awt.Color getForground()
gets the color associated with the segment if available

Returns:
Color.BLACK if no color is associated with segment

setDocument

public void setDocument(javax.swing.text.StyledDocument d)
sets the styled document associated with this segment

Parameters:
d - styled document

getDocument

public javax.swing.text.StyledDocument getDocument()
gets the styled document associated with this segment

Returns:
styled document

getDocumentStart

public int getDocumentStart()
gets the start position in the styled document associated with this segment

Returns:
start position

getDocumentLength

public int getDocumentLength()
gets the length of the segment in the styled document

Returns:
length

hasTag

public boolean hasTag(java.lang.String tagName)
queries if this segment has a particular attribute associated with it

Parameters:
tagName - name of the attribute tage to look for
Returns:
true if the tag exists, false otherwise