model.util
Class Channel

java.lang.Object
  extended by model.util.Channel
All Implemented Interfaces:
Comparable<Channel>

public class Channel
extends Object
implements Comparable<Channel>

This is a simple data class that holds a address, value pair.


Field Summary
 short address
          The address for this channel.
 short value
          The value for this channel.
 
Constructor Summary
Channel()
          This constructor creates a new channel with the default values.
Channel(short _address, short _value)
          This constructor creates a new channel with the given values.
 
Method Summary
 int compareTo(Channel c)
          This method is part of the Comparable interface.
static short[] getAddresses(Channel[] channels)
          This method will return an array of addresses given an array of Channels.
static Channel[] makeChannels(short[] addresses, short[] values)
          This method will return an array of Channels given arrays of addresses and values.
static Channel[] replaceValues(Channel[] oldValues, short[] newValues)
          This method will replace the values in the given channels with the given values.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

address

public short address
The address for this channel.


value

public short value
The value for this channel.

Constructor Detail

Channel

public Channel()
This constructor creates a new channel with the default values.


Channel

public Channel(short _address,
               short _value)
This constructor creates a new channel with the given values.

Parameters:
_address - The address for this channel.
_value - The value for this channel.
Method Detail

compareTo

public int compareTo(Channel c)
This method is part of the Comparable interface.

TODO: Fill in the return info for this method. I always forget the default behavior of compareTo

Specified by:
compareTo in interface Comparable<Channel>
Parameters:
c - The channel to be compared with this channel.

toString

public String toString()
Overrides:
toString in class Object

getAddresses

public static short[] getAddresses(Channel[] channels)
This method will return an array of addresses given an array of Channels.

Parameters:
channels - The array of channels to have the addresses pulled out.
Returns:
The array of addresses from the given channels.

replaceValues

public static Channel[] replaceValues(Channel[] oldValues,
                                      short[] newValues)
This method will replace the values in the given channels with the given values.

Parameters:
oldValues - The channels with the old values. It must be the same length as the array of newValues.
newValues - The array of values to replace the oldValues with. It must be the same length as the array of oldValues.
Returns:
The Channel array with the new values.

makeChannels

public static Channel[] makeChannels(short[] addresses,
                                     short[] values)
This method will return an array of Channels given arrays of addresses and values.

Parameters:
addresses - This is the array of the addresses. It must be the same length as the array of values.
values - This is the array of the values. It must be the same length as the array of addresses.
Returns:
The Channel array made up of the addresses and values given.