org.tritonus.share.sampled
Class AudioFormatSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.ArrayList
              extended byorg.tritonus.share.ArraySet
                  extended byorg.tritonus.share.sampled.AudioFormatSet
All Implemented Interfaces:
Cloneable, Collection, Iterable, List, RandomAccess, Serializable, Set

public class AudioFormatSet
extends ArraySet

A set where the elements are uniquely referenced by AudioFormats.equals rather than their object reference. No 2 equal AudioFormats can exist in the set.

This class provide convenience methods like getAudioFormat(AudioFormat) and matches(AudioFormat).

The contains(Object elem) and get(Object elem) fail, if elem is not an instance of AudioFormat.

You shouldn't use the ArrayList specific functions like those that take index parameters.

It is not possible to add null elements.

Currently, the methods equals(.,.) and matches(.,.) of class AudioFormats are used. Let's hope that they will be integrated into AudioFormat.

See Also:
Serialized Form

Field Summary
protected static AudioFormat[] EMPTY_FORMAT_ARRAY
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
AudioFormatSet()
           
AudioFormatSet(Collection c)
           
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object elem)
           
 boolean contains(Object elem)
           
 Object get(Object elem)
           
 AudioFormat getAudioFormat(AudioFormat elem)
           
 AudioFormat matches(AudioFormat elem)
          Checks whether this Set contains an AudioFormat that matches elem.
 Object set(int index, Object element)
           
 AudioFormat[] toAudioFormatArray()
           
 
Methods inherited from class org.tritonus.share.ArraySet
add, add, set
 
Methods inherited from class java.util.ArrayList
addAll, addAll, clear, clone, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

EMPTY_FORMAT_ARRAY

protected static final AudioFormat[] EMPTY_FORMAT_ARRAY
Constructor Detail

AudioFormatSet

public AudioFormatSet()

AudioFormatSet

public AudioFormatSet(Collection c)
Method Detail

add

public boolean add(Object elem)
Overrides:
add in class ArraySet

contains

public boolean contains(Object elem)
Specified by:
contains in interface Set
Overrides:
contains in class ArrayList

get

public Object get(Object elem)

getAudioFormat

public AudioFormat getAudioFormat(AudioFormat elem)

matches

public AudioFormat matches(AudioFormat elem)
Checks whether this Set contains an AudioFormat that matches elem. The first matching format is returned. If no element matches elem, null is returned.

See Also:
AudioFormats.matches(AudioFormat, AudioFormat)

toAudioFormatArray

public AudioFormat[] toAudioFormatArray()

add

public void add(int index,
                Object element)
Overrides:
add in class ArraySet

set

public Object set(int index,
                  Object element)
Overrides:
set in class ArraySet