Question

Java API Usage: Use the Java API documentation for Standard Edition 7 to answer the following:...

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.

Homework Answers

Answer #1

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 Summary
    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 Formatter.

    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 SortedMap extended with navigation methods returning the closest matches for given search targets.

    NavigableSet<E>

    A SortedSet extended with navigation methods reporting closest matches for given search targets.

    Observer

    A class can implement the Observer interface when it wants to be informed of changes in observable objects.

    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 Map that further provides a total ordering on its keys.

    SortedSet<E>

    A Set that further provides a total ordering on its elements.

b) How many methods are in the class Track?

Class Track

  • java.lang.Object
    • javax.sound.midi.Track
  • public class Track
    extends Object
    A 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 Sequencer: sequencers play sequences, which contain tracks, which contain MIDI events. A sequencer may provide controls that mute or solo individual tracks.

    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 Sequence that maintains its timing. For this reason, a new (empty) track is created by calling the Sequence.createTrack() method, rather than by directly invoking a 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

      Methods
      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:

        ArrayIndexOutOfBoundsException - if the specified index is negative or not less than the current size of this track.

        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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Casting class objects 1.2 Compile and execute the code listed below as it is written. Run...
Casting class objects 1.2 Compile and execute the code listed below as it is written. Run it a second time after uncommenting the line obj.speak();. public class AnimalRunner {    public static void main(String[] args)    {       Dog d1 = new Dog("Fred");       d1.speak();       Object obj = new Dog("Connie");       // obj.speak();    } } The uncommented line causes a compile error because obj is an Object reference variable and class Object doesn’t contain a speak() method. This...
JAVA QUIZ Question 1 Which of the following is false about a "super" call in a...
JAVA QUIZ Question 1 Which of the following is false about a "super" call in a sub class's constructor? Select one: a. It must be the first statement in the constructor b. If you don't include it Java will c. If you don't include it you must have a 0 parameter constructor coded in the super class or no constructors coded at all in the super class d. The sub class constructor containing the super call and the called super...
1. Circle: Implement a Java class with the name Circle. It should be in the package...
1. Circle: Implement a Java class with the name Circle. It should be in the package edu.gcccd.csis. The class has two private instance variables: radius (of the type double) and color (of the type String). The class also has a private static variable: numOfCircles (of the type long) which at all times will keep track of the number of Circle objects that were instantiated. Construction: A constructor that constructs a circle with the given color and sets the radius to...
The following is for a Java Program Create UML Class Diagram for these 4 java classes....
The following is for a Java Program Create UML Class Diagram for these 4 java classes. The diagram should include: 1) All instance variables, including type and access specifier (+, -); 2) All methods, including parameter list, return type and access specifier (+, -); 3) Include Generalization and Aggregation where appropriate. Java Classes description: 1. User Class 1.1 Subclass of Account class. 1.2 Instance variables __ 1.2.1 username – String __ 1.2.2 fullName – String __ 1.2.3 deptCode – int...
IT 168                                         &nb
IT 168                                                                                          Fall 2020 Program 4 Due Date: October 21 at 11:55 PM Problem: A simulation program is needed to determine if the ISU Quiz Bowl Team should comprise mainly of genius students or regular students. A primary requirement of this program that is different from your earlier assignments is that you are required to create 2 different Java classes in the design of your program. Here are some other design details that may be helpful: Design: The classes should...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...