|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object model.ChannelValues
public class ChannelValues
This class stores all the current channel values. Additionally, it decides what the actual value of a channel will be when it is receiving values from multiple sources.
TODO: I need to rewrite this entire class using a numbered priority system. The current system does not allow enough flexibility for the power I want to have in the program. For now, this does work well, and until I have time to rewrite this entire portion of the program, I will leave it as it is.
Field Summary | |
---|---|
static int |
CUE_SOURCE
When a channel value is being changed, the channel source value is passed in with the method. |
static int |
CUE_VALUE_MODE
These modes relate to the status of specific channels at any given time. |
static int |
DEFAULT_VALUE_MODE
These modes relate to the status of specific channels at any given time. |
static int |
FADER_SOURCE
When a channel value is being changed, the channel source value is passed in with the method. |
static int |
FADER_VALUE_MODE
These modes relate to the status of specific channels at any given time. |
static int |
SUBMASTER_SOURCE
When a channel value is being changed, the channel source value is passed in with the method. |
static int |
SUBMASTER_VALUE_MODE
These modes relate to the status of specific channels at any given time. |
Constructor Summary | |
---|---|
ChannelValues(int _maxChannel)
This constructor will create a new ChannelValue object with the set maximum number of channels. |
Method Summary | |
---|---|
Channel[] |
getAllChannels()
This will return the Channel objects for all channels up to the maxChannel value. |
int[] |
getAllChannelSources()
This method will return the source for all channels through maxChannels. |
Channel |
getChannel(Channel channel)
This method will return the Channel object for the given Channel object. |
Channel |
getChannel(short address)
This method will return the channel object for a given address. |
Channel[] |
getChannels()
This will return a Channel object for all channels with a non-zero value. |
Channel[] |
getChannels(Channel[] channels)
This method will return Channel objects for the given channels. |
Channel[] |
getChannels(Channel[] channels,
int source)
This method will return a Channel object with the value from the given source for each given channel address. |
Channel[] |
getChannels(short[] addresses)
This method will return Channel objects for the given addresses. |
Channel[] |
getChannelsForCue()
This will return all the channel values for channels that either arn't zero, or have a fader value of -100. |
int |
getChannelSource(Channel channel)
This method will return the priority of the address in the Channel object. |
int |
getChannelSource(short address)
This method will return the source of the channel at the given address. |
int[] |
getChannelSources(Channel[] channels)
This method will return the sources for the given channels. |
int[] |
getChannelSources(short[] addresses)
This method will return the sources for the given channel addresses. |
int[] |
getChannelSources(short startAddress,
short endAddress)
This method will return the sources for the given range of addresses. |
short |
getChannelValue(Channel channel)
This method will return the value of this channel. |
short |
getChannelValue(short address)
This method will return the value of the channel at the given address. |
short[] |
getChannelValues(short[] addresses)
This method will return the values for the given addresses. |
short[] |
getChannelValues(short startAddress,
short endAddress)
This method will return the channel values from the startAddress to the endAddress. |
Channel[] |
getCueChannels()
This method will return the Channel objects for any channel with a non-zero cue value. |
Channel[] |
getCueChannels(Channel[] channels)
This method will return the Channel objects for the given channels. |
short[] |
resetFaderValues()
This method resets all the fader values back to their defaults. |
void |
updateChannel(Channel channel,
int source)
This method will update the value for the given address, value pair. |
void |
updateChannels(Channel[] channels,
int source)
|
void |
updateChannels(Channel[] channels,
int[] sources)
This method will update the value for a set of address, value pairs from the given sources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FADER_SOURCE
public static final int CUE_SOURCE
public static final int SUBMASTER_SOURCE
public static final int DEFAULT_VALUE_MODE
public static final int FADER_VALUE_MODE
public static final int CUE_VALUE_MODE
public static final int SUBMASTER_VALUE_MODE
Constructor Detail |
---|
public ChannelValues(int _maxChannel)
_maxChannel
- The maximum number of channels for this setup.Method Detail |
---|
public void updateChannel(Channel channel, int source)
channel
- The channel object with the address, value pair to be updated.source
- The source of the new channel value.public void updateChannels(Channel[] channels, int source)
public void updateChannels(Channel[] channels, int[] sources)
channels
- The array of address, value pairs to be updated. This array must
be the same length as the sources array.sources
- The array of sources for the updated channels. This array must be
the same length as the channels array.public short getChannelValue(short address)
TODO: This is one of the methods that needs to be overhauled and replaced with a priority system to get rid fo the mess of if statements and special cases.
address
- The address to return the value of.
public short getChannelValue(Channel channel)
channel
- The Channel object with the address to retrieve
the value for. Only channel.address will be used; the passed in
value will be ignored.
public int getChannelSource(short address)
TODO: This is the other method that needs to be redone with the priority system to replace this mess of if statements and special cases. For now, this works well and won't be changed until I'm ready to rewrite the whole class.
address
- The address to return the source for.
public int getChannelSource(Channel channel)
channel
- The channel object to look up the source for. The
value will be ignored and only the address used.public Channel getChannel(short address)
address
- The address to return the channel object for.
public Channel getChannel(Channel channel)
channel
- The channel to return the Channel object for.
public Channel[] getChannels(short[] addresses)
addresses
- The array of addresses to return Channel objects for.
public Channel[] getChannels(Channel[] channels)
channels
- The channels to return Channel objects for.
public short[] getChannelValues(short startAddress, short endAddress)
startAddress
- The starting address for the values returned. This address will be included
in the returned values.endAddress
- The ending address for the values returned. This address will be included in
the returning values.
public int[] getChannelSources(short startAddress, short endAddress)
startAddress
- The start address for the range of results. This address will be included
in the results.endAddress
- The end address for the range of results. This address will be included in the
results.
public Channel[] getChannels()
public Channel[] getChannels(Channel[] channels, int source)
channels
- The channels that you want the values from the given source for. Only the
address parameter from these channels will the used, the value will be ignored.source
- The source to get the values from.
public Channel[] getChannelsForCue()
public Channel[] getAllChannels()
public Channel[] getCueChannels()
public Channel[] getCueChannels(Channel[] channels)
channels
- The cue values for these channels will be returned. The value from these channels is ignored.
public short[] getChannelValues(short[] addresses)
addresses
- The addresses to return the values for.
public int[] getChannelSources(short[] addresses)
addresses
- The array of address to return the sources for.
public int[] getChannelSources(Channel[] channels)
channels
- The channels to return the sources for.
public int[] getAllChannelSources()
public short[] resetFaderValues()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |