bbc.rd.tvanytime
Class Duration

java.lang.Object
  extended by bbc.rd.tvanytime.Duration

public class Duration
extends java.lang.Object

Duration: Represents a duration (of the form "PT00H25M30S");

Version:
1.0
Author:
Tim Sargeant, BBC Research & Development, April 2002, Tristan Ferne, BBC Research & Development, September 2003

Constructor Summary
Duration()
          Constructor for objects of type Duration represented in String of the form (e.g.
Duration(long duration)
          Constructor for objects of type Duration
Duration(java.lang.String duration)
          Constructor for objects of type Duration
 
Method Summary
 java.lang.Object clone()
          Clones itself.
 int getDays()
          Get the days part of the duration string.
 java.lang.String getDurationAsString()
          Get the duration
 long getDurationInMsec()
          Get the duration in milliseconds
 int getHours()
          Get the hours part of the hh:mm:ss
 int getMinutes()
          Get the minutes part of the hh:mm:ss
 int getSeconds()
          Get the seconds part of the hh:mm:ss
 void setDuration(long duration)
          Set the duration
 void setDuration(java.lang.String duration)
          Set the duration
 java.lang.String toString()
          Returns string representation of this object.
 java.lang.String toString(int indent)
          Returns string representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Duration

public Duration()
Constructor for objects of type Duration represented in String of the form (e.g. "PT00H25M30S")


Duration

public Duration(java.lang.String duration)
         throws TVAnytimeException
Constructor for objects of type Duration

Parameters:
duration - string representation of the duration (e.g. "PT00H25M30S")
Throws:
TVAnytimeException - thrown when the duration string is of an unexpected format

Duration

public Duration(long duration)
Constructor for objects of type Duration

Parameters:
duration - represented by number of milliseconds
Method Detail

getDurationAsString

public java.lang.String getDurationAsString()
Get the duration

Returns:
the String representation of the duration (e.g. "PT00H25M30S")

getDurationInMsec

public long getDurationInMsec()
Get the duration in milliseconds

Returns:
the duration in ms

getDays

public int getDays()
Get the days part of the duration string.

Returns:
the duration days part

getHours

public int getHours()
Get the hours part of the hh:mm:ss

Returns:
the duration hours part of the hh:mm:ss

getMinutes

public int getMinutes()
Get the minutes part of the hh:mm:ss

Returns:
the duration minutes part of the hh:mm:ss

getSeconds

public int getSeconds()
Get the seconds part of the hh:mm:ss

Returns:
the duration seconds part of the hh:mm:ss

setDuration

public void setDuration(java.lang.String duration)
                 throws TVAnytimeException
Set the duration

Parameters:
duration - string representation of the duration (e.g. "PT00H25M30S")
Throws:
TVAnytimeException

setDuration

public void setDuration(long duration)
Set the duration

Parameters:
duration - number of milliseconds

toString

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

Overrides:
toString in class java.lang.Object
Returns:
string representation of this object.

toString

public java.lang.String toString(int indent)
Returns string representation of this object.

Parameters:
indent - number of tabs to put before the string.
Returns:
string representation of this object.

clone

public java.lang.Object clone()
Clones itself.

Overrides:
clone in class java.lang.Object
Returns:
A copy of itself.