com.adobe.mediacore.timeline.advertising
Class AdBreak

java.lang.Object
  extended by com.adobe.mediacore.timeline.advertising.AdBreak
All Implemented Interfaces:
TimelineMarker, Comparable<AdBreak>

public final class AdBreak
extends Object
implements TimelineMarker, Comparable<AdBreak>

An ad break provides a unified view on several ads that will be played at some point in time, during playback. The ad break has a starting time and a duration, which is a sum of all the ads that it contains.


Method Summary
 Iterator<Ad> adsIterator()
          Returns an iterator which can be used to iterate through the ads.
 AdBreak cloneFor(PlacementInformation placementInformation)
           
 int compareTo(AdBreak adBreak)
           
static AdBreak createAdBreak(List<Ad> ads, long time, long replaceDuration, String tag)
          Factory method: Creates a new ad break.
 Ad getAdForContentId(int contentId)
           
 long getDuration()
          Returns the total ad break duration.
 Ad getFirstAd()
           
 long getInitialReplaceDuration()
           
 Ad getLastAd()
           
 long getReplaceDuration()
          Returns the ad break replace duration.
 String getTag()
           
 long getTime()
          Returns the starting time for this ad break.
 boolean isValid()
           
 long size()
           
 String toString()
          Returns a String representation of the current ad break.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createAdBreak

public static AdBreak createAdBreak(List<Ad> ads,
                                    long time,
                                    long replaceDuration,
                                    String tag)
Factory method: Creates a new ad break.

Parameters:
ads - The ads that this ad break will contain.
time - The starting time for this ad break.
replaceDuration - If 0, the AdBreak content will be inserted (inflating the timeline). If greater than 0, the AdBreak content will replace the main content for the specified duration (timeline remains constant)
tag - An arbitrary string value that can be attached to the AdBreak object.
Returns:
The newly minted AdBreak object.

size

public long size()

adsIterator

public Iterator<Ad> adsIterator()
Returns an iterator which can be used to iterate through the ads.

Returns:
the ads iterator.

getTime

public long getTime()
Returns the starting time for this ad break.

Specified by:
getTime in interface TimelineMarker
Returns:
the starting time.

getReplaceDuration

public long getReplaceDuration()
Returns the ad break replace duration.

Returns:
the ad break replace duration.

getInitialReplaceDuration

public long getInitialReplaceDuration()

getDuration

public long getDuration()
Returns the total ad break duration.

Specified by:
getDuration in interface TimelineMarker
Returns:
the ad break duration.

isValid

public boolean isValid()

getTag

public String getTag()
Returns:
the ad break tag.

compareTo

public int compareTo(AdBreak adBreak)
Specified by:
compareTo in interface Comparable<AdBreak>

getAdForContentId

public Ad getAdForContentId(int contentId)

getFirstAd

public Ad getFirstAd()
Returns:
the first Ad in the Ad Break

getLastAd

public Ad getLastAd()
Returns:
the last Ad in the ad break.

cloneFor

public AdBreak cloneFor(PlacementInformation placementInformation)

toString

public String toString()
Returns a String representation of the current ad break. As an ad break can have multiple ads with significant amount of custom metadata associated with them, we will not include ads and their metadata content in this representation.

Overrides:
toString in class Object
Returns:
a string containing the tag, time, duration and replaceDuration properties