com.bramosystems.oss.player.core.client
Class PlayTime

java.lang.Object
  extended by com.bramosystems.oss.player.core.client.PlayTime
All Implemented Interfaces:
java.lang.Comparable<PlayTime>

public final class PlayTime
extends java.lang.Object
implements java.lang.Comparable<PlayTime>

Utility class with methods to manipulate playback time.

Since:
1.3
Author:
Sikirulai Braheem

Constructor Summary
PlayTime()
          Creates a PlayTime object
PlayTime(double milliseconds)
          Creates a PlayTime object set to the specified milliseconds
PlayTime(int hour, int minute, int second, int fract)
          Creates a PlayTime object set to the specified time
PlayTime(java.lang.String time)
          Creates a PlayTime object set to the specified time.
 
Method Summary
 PlayTime add(int milliseconds)
          Adds millseconds to the current play time
 int compareTo(PlayTime o)
           
 boolean equals(java.lang.Object obj)
           
 int getFract()
          Returns the hundredths of a second represented by this PlayTime object
 int getHour()
          Returns the hour represented by this PlayTime object
 int getMinute()
          Returns the minute represented by this PlayTime object
 int getSecond()
          Returns the seconds represented by this PlayTime object
 double getTime()
          Returns the current PlayTime in milliseconds
 int hashCode()
           
 PlayTime reduce(int milliseconds)
          Reduces the current play time by millseconds
 void setFract(int fract)
          Sets the hundredths of a second of this PlayTime object
 void setHour(int hour)
          Sets the hour of this PlayTime object
 void setMinute(int minute)
          Sets the minute of this PlayTime object
 void setSecond(int second)
          Sets the seconds of this PlayTime object
 java.lang.String toString()
          Returns the string representation of this object in full-format
 java.lang.String toString(boolean fullFormat)
          Returns the string representation of this object
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlayTime

public PlayTime()
Creates a PlayTime object


PlayTime

public PlayTime(int hour,
                int minute,
                int second,
                int fract)
Creates a PlayTime object set to the specified time

Parameters:
hour - the hour
minute - the minute
second - the seconds
fract - the hundredths of a second

PlayTime

public PlayTime(double milliseconds)
Creates a PlayTime object set to the specified milliseconds

Parameters:
milliseconds - time in milliseconds

PlayTime

public PlayTime(java.lang.String time)
Creates a PlayTime object set to the specified time.

time should be in the format hour:min:sec.fract. hour and fract may be omitted unless required.

Parameters:
time - the time
Method Detail

add

public PlayTime add(int milliseconds)
Adds millseconds to the current play time

Parameters:
milliseconds - the milliseconds to add
Returns:
the updated play time

reduce

public PlayTime reduce(int milliseconds)
Reduces the current play time by millseconds

Parameters:
milliseconds - the milliseconds to reduce
Returns:
the updated play time

getTime

public double getTime()
Returns the current PlayTime in milliseconds

Returns:
play time in milliseconds

getHour

public int getHour()
Returns the hour represented by this PlayTime object

Returns:
the hour

setHour

public void setHour(int hour)
Sets the hour of this PlayTime object

Parameters:
hour - the hour

getMinute

public int getMinute()
Returns the minute represented by this PlayTime object

Returns:
the minute

setMinute

public void setMinute(int minute)
Sets the minute of this PlayTime object

Parameters:
minute - the minute

getSecond

public int getSecond()
Returns the seconds represented by this PlayTime object

Returns:
the seconds

setSecond

public void setSecond(int second)
Sets the seconds of this PlayTime object

Parameters:
second - the seconds

getFract

public int getFract()
Returns the hundredths of a second represented by this PlayTime object

Returns:
the hundredths of a second

setFract

public void setFract(int fract)
Sets the hundredths of a second of this PlayTime object

Parameters:
fract - the hundredths of a second

toString

public java.lang.String toString()
Returns the string representation of this object in full-format

Overrides:
toString in class java.lang.Object
Returns:
the string representation of the time
See Also:
toString(boolean)

toString

public java.lang.String toString(boolean fullFormat)
Returns the string representation of this object

The string representation is either in its full format (i.e. 00:00:00.000) or in the short form. The short form excludes the hour (if hour is less than 1) and hundredths parts.

Parameters:
fullFormat - true to represent this object in the full format, false otherwise
Returns:
the string representation

compareTo

public int compareTo(PlayTime o)
Specified by:
compareTo in interface java.lang.Comparable<PlayTime>

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2009-2011. All Rights Reserved.