speech
Class Sentence

java.lang.Object
  extended by speech.Sentence
All Implemented Interfaces:
java.io.Serializable

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

This class represents a single sentence

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
Sentence(AbstractCharacterSprite character, java.lang.String line, int lineWidth, java.awt.Color color, int time)
          Creates a new sentence with the specified parameters
Sentence(AbstractCharacterSprite character, java.lang.String line, int lineWidth, java.lang.String soundPath, java.awt.Color color)
          Creates a new sentence with the specified parameters
 
Method Summary
 java.lang.String getAssignedSoundFile()
          Returns the path+filename of the sound file that was assigned to this sentence
 AbstractCharacterSprite getRelatedCharacter()
          Returns the character related to the sentence, i.e. the character that is speaking the sentence
 boolean isCurrentlySpoken()
          Determines whether the sentence is currently spoken by a character
 void render(java.awt.Graphics2D g)
          Render method of the sentence.
 void update(long elapsedTime)
          Update method of the sentence
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sentence

public Sentence(AbstractCharacterSprite character,
                java.lang.String line,
                int lineWidth,
                java.awt.Color color,
                int time)
Creates a new sentence with the specified parameters

Parameters:
character - the character that says the sentence
line - the line to be spoken
lineWidth - width of a line until line wrap
color - the color to display the sentence with
time - the time the sentence shall be displayed (in miliseconds)

Sentence

public Sentence(AbstractCharacterSprite character,
                java.lang.String line,
                int lineWidth,
                java.lang.String soundPath,
                java.awt.Color color)
Creates a new sentence with the specified parameters

Parameters:
character - the character that says the sentence
line - the line to be spoken
lineWidth - width of a line until line wrap
soundPath - path+filename to sound file corresponding to this sentence
color - the color to display the sentence with
Method Detail

getRelatedCharacter

public AbstractCharacterSprite getRelatedCharacter()
Returns the character related to the sentence, i.e. the character that is speaking the sentence

Returns:
character related to the sentence

getAssignedSoundFile

public java.lang.String getAssignedSoundFile()
Returns the path+filename of the sound file that was assigned to this sentence

Returns:
sound file assigned to this sentence

update

public void update(long elapsedTime)
Update method of the sentence

Parameters:
elapsedTime - time between two frames

render

public void render(java.awt.Graphics2D g)
Render method of the sentence. The sentence gets only rendered, if its display time has not expired

Parameters:
g - main render context

isCurrentlySpoken

public boolean isCurrentlySpoken()
Determines whether the sentence is currently spoken by a character

Returns:
is sentence currently spoken? --> true=yes, false=no