Lizzy v1.1.1

christophedelory.playlist
Class AbstractTimeContainer

java.lang.Object
  extended by christophedelory.playlist.AbstractPlaylistComponent
      extended by christophedelory.playlist.AbstractTimeContainer
Direct Known Subclasses:
Parallel, Sequence

public abstract class AbstractTimeContainer
extends AbstractPlaylistComponent

The base definition of time containers.

Version:
$Revision: 92 $
Author:
Christophe Delory

Constructor Summary
AbstractTimeContainer()
           
 
Method Summary
 void acceptDown(PlaylistVisitor visitor)
          Accepts the specified playlist visitor.
 void addComponent(AbstractPlaylistComponent component)
          Appends the specified playlist component to the end of this container.
 void addComponent(int index, AbstractPlaylistComponent component)
          Inserts the specified playlist component at the specified position in this container.
 AbstractPlaylistComponent[] getComponents()
          Returns an ordered array of playlist components present in this container.
 int getComponentsNumber()
          Returns the number of playlist components in this container.
 boolean removeComponent(AbstractPlaylistComponent component)
          Removes the first occurrence of the specified playlist component in this container.
 AbstractPlaylistComponent removeComponent(int index)
          Removes the playlist component at the specified position in this container.
 
Methods inherited from class christophedelory.playlist.AbstractPlaylistComponent
acceptUp, getParent, getRepeatCount, setParent, setRepeatCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTimeContainer

public AbstractTimeContainer()
Method Detail

getComponents

public AbstractPlaylistComponent[] getComponents()
Returns an ordered array of playlist components present in this container.

Returns:
an array of playlist components. May be empty but not null.
See Also:
addComponent(christophedelory.playlist.AbstractPlaylistComponent), removeComponent(christophedelory.playlist.AbstractPlaylistComponent), getComponentsNumber()

addComponent

public void addComponent(AbstractPlaylistComponent component)
Appends the specified playlist component to the end of this container.

Parameters:
component - the playlist component to be appended to this container. Shall not be null.
Throws:
NullPointerException - if component is null.
See Also:
getComponents(), removeComponent(christophedelory.playlist.AbstractPlaylistComponent), addComponent(int,AbstractPlaylistComponent)

addComponent

public void addComponent(int index,
                         AbstractPlaylistComponent component)
Inserts the specified playlist component at the specified position in this container. Shifts the component currently at that position (if any) and any subsequent components to the right (adds one to their indices).

Parameters:
index - the index at which the specified component is to be inserted.
component - the playlist component to be inserted in this container. Shall not be null.
Throws:
NullPointerException - if component is null.
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > getComponentsNumber()).
See Also:
getComponents(), addComponent(christophedelory.playlist.AbstractPlaylistComponent), removeComponent(christophedelory.playlist.AbstractPlaylistComponent)

removeComponent

public boolean removeComponent(AbstractPlaylistComponent component)
Removes the first occurrence of the specified playlist component in this container. If the container does not contain the element, it is unchanged.

Parameters:
component - the playlist component to be removed from this container, if any. Shall not be null.
Returns:
true if the container contained the specified element, false otherwise.
Throws:
NullPointerException - if component is null.
See Also:
addComponent(christophedelory.playlist.AbstractPlaylistComponent), getComponents(), removeComponent(int)

removeComponent

public AbstractPlaylistComponent removeComponent(int index)
Removes the playlist component at the specified position in this container. Shifts any subsequent elements to the left (subtracts one from their indices).

Parameters:
index - the index of the component to be removed.
Returns:
the component that was removed from the container.
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getComponentsNumber()).
See Also:
addComponent(christophedelory.playlist.AbstractPlaylistComponent), getComponents(), removeComponent(AbstractPlaylistComponent)

getComponentsNumber

public int getComponentsNumber()
Returns the number of playlist components in this container.

Returns:
the number of playlist components in this container.
See Also:
getComponents()

acceptDown

public void acceptDown(PlaylistVisitor visitor)
                throws Exception
Description copied from class: AbstractPlaylistComponent
Accepts the specified playlist visitor.

Specified by:
acceptDown in class AbstractPlaylistComponent
Parameters:
visitor - a visitor. Shall not be null.
Throws:
NullPointerException - if visitor is null.
Exception - if any error occurs during the visit.

© 2008-2009 Christophe Delory

Copyright © 2008-2009 Christophe Delory. All Rights Reserved.