org.tritonus.share.sampled
Class AudioFormatSet
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
org.tritonus.share.ArraySet
org.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
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 interface java.util.Set |
addAll, clear, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
EMPTY_FORMAT_ARRAY
protected static final AudioFormat[] EMPTY_FORMAT_ARRAY
AudioFormatSet
public AudioFormatSet()
AudioFormatSet
public AudioFormatSet(Collection c)
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