fi.hut.tml.xsmiles.mlfc.smil.basic
Class TimeImpl

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.smil.basic.TimeImpl
All Implemented Interfaces:
org.w3c.dom.events.EventListener, Time

public class TimeImpl
extends java.lang.Object
implements Time, org.w3c.dom.events.EventListener

The Time interface is a datatype that represents times within the timegraph. A Time has a type, key values to describe the time, and a boolean to indicate whether the values are currently unresolved. Still need to address the wallclock values.


Field Summary
static short SMIL_TIME_ACCESSKEY
           
static short SMIL_TIME_EVENT_BASED
           
static short SMIL_TIME_INDEFINITE
           
static short SMIL_TIME_MEDIA_MARKER
           
static short SMIL_TIME_OFFSET
           
static short SMIL_TIME_REPEAT
           
static short SMIL_TIME_SYNC_BASED
           
static short SMIL_TIME_WALLCLOCK
           
 
Constructor Summary
TimeImpl()
          Contructor to define blank time, defaults to indefinite.
TimeImpl(int timeInt)
          Contructor to define the time.
TimeImpl(long time, long offset, short tt, ElementBasicTimeImpl base, ElementBasicTimeImpl dependent, boolean baseBegin, boolean beginList, boolean resolved, boolean indefinite)
          Contructor to define the time and type.
TimeImpl(MyFloat timeFloat)
          Contructor to define the time.
TimeImpl(java.lang.String timeString)
          Contructor to define the time.
TimeImpl(java.lang.String timeString, SMILDocumentImpl doc, ElementBasicTimeImpl e, boolean beginList)
          Contructor to define the time.
 
Method Summary
 boolean getBaseBegin()
          If true , indicates that a sync-based time is relative to the begin of the baseElement.
 org.w3c.dom.Element getBaseElement()
          The base element for a sync-based or event-based time.
 java.lang.String getEvent()
          The name of the event for an event-based time.
 java.lang.String getMarker()
          The name of the marker from the media element, for media marker times.
 MyFloat getOffset()
          The clock value in seconds relative to the syncbase or eventbase.
 boolean getResolved()
          A boolean indicating whether the current Time has been fully resolved to the document schedule.
 MyFloat getResolvedOffset()
          The clock value in seconds relative to the parent time container begin.
 java.lang.String getString()
          For debugging purposes
 short getTimeType()
          A code representing the type of the underlying object, as defined above.
 long getTimeValue()
          Returns the time value.
 void handleEvent(org.w3c.dom.events.Event evt)
          EventBase event received - restart / end element This method handles the event, when it is received THIS SHOULD BE IN ELEMENT- TO SECURE CORRECT click-click BEHAVIOUR! (in case of exception & wrong event order)
 void intervalBeginChanged(TimeImpl begin)
           
 void intervalCreated(TimeImpl begin, TimeImpl end)
           
 void intervalEndChanged(TimeImpl end)
           
 boolean isEqualTo(Time time)
          Is time equal to this.
 boolean isGreaterThan(Time time)
          Is time greater than this.
 boolean isInBeginList()
          Returns true if this Time is part of begin time list.
 boolean isIndefinite()
           
 boolean isNegative()
          Checks if the time is negative.
 void lock()
          Lock this time - changes cannot be made after this call.
 void setBaseBegin(boolean baseBegin)
           
 void setBaseElement(org.w3c.dom.Element baseElement)
           
 void setEvent(java.lang.String event)
           
 void setMarker(java.lang.String marker)
           
 void setOffset(MyFloat offset)
           
 void setTimeValue(Time t)
          Forces this Time object to have the same time value offset as t.
 void unlock()
          Unlock this time - changes can be made after this call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMIL_TIME_INDEFINITE

public static final short SMIL_TIME_INDEFINITE
See Also:
Constant Field Values

SMIL_TIME_OFFSET

public static final short SMIL_TIME_OFFSET
See Also:
Constant Field Values

SMIL_TIME_SYNC_BASED

public static final short SMIL_TIME_SYNC_BASED
See Also:
Constant Field Values

SMIL_TIME_EVENT_BASED

public static final short SMIL_TIME_EVENT_BASED
See Also:
Constant Field Values

SMIL_TIME_WALLCLOCK

public static final short SMIL_TIME_WALLCLOCK
See Also:
Constant Field Values

SMIL_TIME_MEDIA_MARKER

public static final short SMIL_TIME_MEDIA_MARKER
See Also:
Constant Field Values

SMIL_TIME_REPEAT

public static final short SMIL_TIME_REPEAT
See Also:
Constant Field Values

SMIL_TIME_ACCESSKEY

public static final short SMIL_TIME_ACCESSKEY
See Also:
Constant Field Values
Constructor Detail

TimeImpl

public TimeImpl()
Contructor to define blank time, defaults to indefinite.


TimeImpl

public TimeImpl(MyFloat timeFloat)
Contructor to define the time.

Parameters:
timeFloat - Time float, which will be parsed.

TimeImpl

public TimeImpl(long time,
                long offset,
                short tt,
                ElementBasicTimeImpl base,
                ElementBasicTimeImpl dependent,
                boolean baseBegin,
                boolean beginList,
                boolean resolved,
                boolean indefinite)
Contructor to define the time and type.

Parameters:
time - Time long, which will be parsed.
tt - TimeType
base - Base element, will have intervalchangedListener
baseBegin - true if based on begin attribute

TimeImpl

public TimeImpl(int timeInt)
Contructor to define the time.


TimeImpl

public TimeImpl(java.lang.String timeString)
Contructor to define the time.

Parameters:
timeString - Time string, which will be parsed.

TimeImpl

public TimeImpl(java.lang.String timeString,
                SMILDocumentImpl doc,
                ElementBasicTimeImpl e,
                boolean beginList)
Contructor to define the time. This can also handle syncbase clock values, using the SMILDocumentImpl passed in.

Parameters:
timeString - Time string, which will be parsed.
doc - SMILDocumentImpl, to handle syncbase clock values
e - Element, which will receive time changes from syncbase element
beginList - true if this Time is part of beginList, otherwise false
Method Detail

lock

public void lock()
Lock this time - changes cannot be made after this call.


unlock

public void unlock()
Unlock this time - changes can be made after this call.


setTimeValue

public void setTimeValue(Time t)
Forces this Time object to have the same time value offset as t. Only the time value will change - not the Time type or syncbase element. This method is used to change the time value for a resolved syncbase clock value. If t is null, this Time object will be unresolved.

Specified by:
setTimeValue in interface Time
Parameters:
t - Time Object

getTimeValue

public long getTimeValue()
Returns the time value. This is only for internal processing. Use getResolvedOffset().

Specified by:
getTimeValue in interface Time
Returns:
timeValue

isInBeginList

public boolean isInBeginList()
Returns true if this Time is part of begin time list.

Specified by:
isInBeginList in interface Time
Returns:
true if this time is part of begin time list.

getResolved

public boolean getResolved()
A boolean indicating whether the current Time has been fully resolved to the document schedule. Note that for this to be true, the current Time must be defined (not indefinite), the syncbase and all Time 's that the syncbase depends on must be defined (not indefinite), and the begin Time of all ascendent time containers of this element and all Time elements that this depends upon must be defined (not indefinite).
If this Time is based upon an event, this Time will only be resolved once the specified event has happened, subject to the constraints of the time container.
Note that this may change from true to false when the parent time container ends its simple duration (including when it repeats or restarts).

Specified by:
getResolved in interface Time

getResolvedOffset

public MyFloat getResolvedOffset()
The clock value in seconds relative to the parent time container begin. This indicates the resolved time relationship to the parent time container. This is only valid if resolved is true.

Specified by:
getResolvedOffset in interface Time

getTimeType

public short getTimeType()
A code representing the type of the underlying object, as defined above.

Specified by:
getTimeType in interface Time

getOffset

public MyFloat getOffset()
The clock value in seconds relative to the syncbase or eventbase. Default value is 0 .

Specified by:
getOffset in interface Time
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised on attempts to modify this readonly attribute.

setOffset

public void setOffset(MyFloat offset)
               throws org.w3c.dom.DOMException
Specified by:
setOffset in interface Time
Throws:
org.w3c.dom.DOMException

getBaseElement

public org.w3c.dom.Element getBaseElement()
The base element for a sync-based or event-based time.

Specified by:
getBaseElement in interface Time
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised on attempts to modify this readonly attribute.

setBaseElement

public void setBaseElement(org.w3c.dom.Element baseElement)
                    throws org.w3c.dom.DOMException
Specified by:
setBaseElement in interface Time
Throws:
org.w3c.dom.DOMException

getBaseBegin

public boolean getBaseBegin()
If true , indicates that a sync-based time is relative to the begin of the baseElement. If false , indicates that a sync-based time is relative to the active end of the baseElement.

Specified by:
getBaseBegin in interface Time
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised on attempts to modify this readonly attribute.

setBaseBegin

public void setBaseBegin(boolean baseBegin)
                  throws org.w3c.dom.DOMException
Specified by:
setBaseBegin in interface Time
Throws:
org.w3c.dom.DOMException

getEvent

public java.lang.String getEvent()
The name of the event for an event-based time. Default value is null .

Specified by:
getEvent in interface Time
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised on attempts to modify this readonly attribute.

setEvent

public void setEvent(java.lang.String event)
              throws org.w3c.dom.DOMException
Specified by:
setEvent in interface Time
Throws:
org.w3c.dom.DOMException

getMarker

public java.lang.String getMarker()
The name of the marker from the media element, for media marker times. Default value is null .

Specified by:
getMarker in interface Time
Throws:
org.w3c.dom.DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised on attempts to modify this readonly attribute.

setMarker

public void setMarker(java.lang.String marker)
               throws org.w3c.dom.DOMException
Specified by:
setMarker in interface Time
Throws:
org.w3c.dom.DOMException

getString

public java.lang.String getString()
For debugging purposes

Specified by:
getString in interface Time
Returns:
time in seconds

isGreaterThan

public boolean isGreaterThan(Time time)
Is time greater than this.

Specified by:
isGreaterThan in interface Time
Parameters:
time - Time value
Returns:
true if this is greater than time.

isEqualTo

public boolean isEqualTo(Time time)
Is time equal to this.

Specified by:
isEqualTo in interface Time
Parameters:
time - Time value
Returns:
true if this is greater than time.

isNegative

public boolean isNegative()
Checks if the time is negative.

Specified by:
isNegative in interface Time
Returns:
true if time is negative.

isIndefinite

public boolean isIndefinite()
Specified by:
isIndefinite in interface Time
Returns:
true if time is indefinite

intervalCreated

public void intervalCreated(TimeImpl begin,
                            TimeImpl end)

handleEvent

public void handleEvent(org.w3c.dom.events.Event evt)
EventBase event received - restart / end element This method handles the event, when it is received THIS SHOULD BE IN ELEMENT- TO SECURE CORRECT click-click BEHAVIOUR! (in case of exception & wrong event order)

Specified by:
handleEvent in interface org.w3c.dom.events.EventListener

intervalBeginChanged

public void intervalBeginChanged(TimeImpl begin)

intervalEndChanged

public void intervalEndChanged(TimeImpl end)


X-Smiles 1.2