edu.uiuc.cs397rhc.game
Class Instrumentation

java.lang.Object
  extended by edu.uiuc.cs397rhc.game.Instrumentation

public class Instrumentation
extends java.lang.Object

Represents the parts of a MIDI piece that can be assigned to a team. These are any channel, or any notes on the drum channel (channel 9).

Author:
Pedro DeRose

Constructor Summary
Instrumentation(int[] channels, int[] percussion)
          Creates a new Instrumentation for the given channels and notes on the drum channel.
 
Method Summary
static Instrumentation create(java.util.Properties props, java.lang.String prefix)
          Creates an Instrumentation as read from a set of properties.
 java.util.Set<java.lang.Integer> getChannels()
          Gets the channels.
protected  java.util.Set<java.lang.Integer> getChannelSet()
          Gets the channels.
 java.util.Set<java.lang.Integer> getPercussion()
          Gets the drum notes.
protected  java.util.Set<java.lang.Integer> getPercussionSet()
          Gets the drum notes.
 boolean includesDrumChannel()
          Whether the drum channel has been assigned.
protected  void removeAll(Instrumentation other)
          Un-assigns all channels or drum notes that have already been assigned to the given Instrumentation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Instrumentation

public Instrumentation(int[] channels,
                       int[] percussion)
Creates a new Instrumentation for the given channels and notes on the drum channel.

Parameters:
channels - an int array representing channels
percussion - an int array representing notes on the drum channel
Method Detail

getChannels

public java.util.Set<java.lang.Integer> getChannels()
Gets the channels.

Returns:
the Set of channels

getPercussion

public java.util.Set<java.lang.Integer> getPercussion()
Gets the drum notes.

Returns:
the Set of drum notes

includesDrumChannel

public boolean includesDrumChannel()
Whether the drum channel has been assigned.

Returns:
true if the drum channel has been assigned, false otherwise

getChannelSet

protected java.util.Set<java.lang.Integer> getChannelSet()
Gets the channels. This protected version returns a reference instead of a clone.

Returns:
the Set of channels

getPercussionSet

protected java.util.Set<java.lang.Integer> getPercussionSet()
Gets the drum notes. This protected version returns a reference instead of a clone.

Returns:
the Set of drum notes

removeAll

protected void removeAll(Instrumentation other)
Un-assigns all channels or drum notes that have already been assigned to the given Instrumentation.

Parameters:
other - the given Instrumentation

create

public static Instrumentation create(java.util.Properties props,
                                     java.lang.String prefix)
Creates an Instrumentation as read from a set of properties. The format is:
    prefix.channels={channel1,channel2,...}
    prefix.percussion={note1,note1,...}
 
Empty instrumentations ("{}") are allowed.

Parameters:
props - the set of properties to examine
prefix - the prefix of the relevant properties
Returns:
the intrumentation as specified by the properties