Java API Usage: Use the Java API documentation for Standard
Edition 7 to answer the following:
a) List the full prototype for the methods that must be coded if a
class implements the java.util interface named Iterator.
b) How many methods are in the class Track?
c) What package is the class Track located in?
I am asking for the signature of the method, which is the
first line which tells the return data type, the name of the
method, and its parameters.
a) List the full prototype for the methods that must be coded if a class implements the java.util interface named Iterator.
Package java.util
Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
See: Description
Interface | Description |
---|---|
Collection<E> |
The root interface in the collection hierarchy. |
Comparator<T> |
A comparison function, which imposes a total ordering on some collection of objects. |
Deque<E> |
A linear collection that supports element insertion and removal at both ends. |
Enumeration<E> |
An object that implements the Enumeration interface generates a series of elements, one at a time. |
EventListener |
A tagging interface that all event listener interfaces must extend. |
Formattable |
The Formattable interface must be implemented by any class that
needs to perform custom formatting using the 's' conversion
specifier of |
Iterator<E> |
An iterator over a collection. |
List<E> |
An ordered collection (also known as a sequence). |
ListIterator<E> |
An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator's current position in the list. |
Map<K,V> |
An object that maps keys to values. |
Map.Entry<K,V> |
A map entry (key-value pair). |
NavigableMap<K,V> |
A |
NavigableSet<E> |
A |
Observer |
A class can implement the |
Queue<E> |
A collection designed for holding elements prior to processing. |
RandomAccess |
Marker interface used by List implementations to indicate that they support fast (generally constant time) random access. |
Set<E> |
A collection that contains no duplicate elements. |
SortedMap<K,V> |
A |
SortedSet<E> |
A |
b) How many methods are in the class Track?
Class Track
public class Track extends ObjectA MIDI track is an independent stream of MIDI events (time-stamped MIDI data) that can be stored along with other tracks in a standard MIDI file. The MIDI specification allows only 16 channels of MIDI data, but tracks are a way to get around this limitation. A MIDI file can contain any number of tracks, each containing its own stream of up to 16 channels of MIDI data.
A Track
occupies a middle level in the hierarchy of
data played by a
: sequencers
play sequences, which contain tracks, which contain MIDI events. A
sequencer may provide controls that mute or solo individual
tracks.Sequencer
The timing information and resolution for a track is controlled
by and stored in the sequence containing the track. A given
Track
is considered to belong to the particular
that maintains its timing. For
this reason, a new (empty) track is created by calling the
Sequence
method, rather
than by directly invoking a Sequence.createTrack()
Track
constructor.
The Track
class provides methods to edit the track
by adding or removing MidiEvent
objects from it. These
operations keep the event list in the correct time order. Methods
are also included to obtain the track's size, in terms of either
the number of events it contains or its duration in ticks.
See Also:
Sequencer.setTrackMute(int, boolean)
,
Sequencer.setTrackSolo(int, boolean)
Method Summary
Modifier and Type | Method and Description |
---|---|
boolean |
add(MidiEvent event)
Adds a new event to the track. |
MidiEvent |
get(int index)
Obtains the event at the specified index. |
boolean |
remove(MidiEvent event)
Removes the specified event from the track. |
int |
size()
Obtains the number of events in this track. |
long |
ticks()
Obtains the length of the track, expressed in MIDI ticks. |
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, toString, wait, wait, wait
Method Detail
add
public boolean add(MidiEvent event)
Adds a new event to the track. However, if the event is already contained in the track, it is not added again. The list of events is kept in time order, meaning that this event inserted at the appropriate place in the list, not necessarily at the end.
Parameters:
event
- the event to add
Returns:
true
if the event did not already exist in the
track and was added, otherwise false
remove
public boolean remove(MidiEvent event)
Removes the specified event from the track.
Parameters:
event
- the event to remove
Returns:
true
if the event existed in the track and was
removed, otherwise false
get
public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException
Obtains the event at the specified index.
Parameters:
index
- the location of the desired event in the
event vector
Throws:
- if
the specified index is negative or not less than the current size
of this track.ArrayIndexOutOfBoundsException
ArrayIndexOutOfBoundsException
See Also:
size()
size
public int size()
Obtains the number of events in this track.
Returns:
the size of the track's event vector
ticks
public long ticks()
Obtains the length of the track, expressed in MIDI ticks. (The
duration of a tick in seconds is determined by the timing
resolution of the Sequence
containing this track, and
also by the tempo of the music as set by the sequencer.)
Returns:
the duration, in ticks
See Also:
Sequence.Sequence(float, int)
,
Sequencer.setTempoInBPM(float)
,
Sequencer.getTickPosition()
c) What package is the class Track located in?
The package class Track is loated in
javax.sound.midi,
Package javax.sound.midi
there is a very big list you can find it in oracle docs
Get Answers For Free
Most questions answered within 1 hours.