model
Class LightModel

java.lang.Object
  extended by model.LightModel

public class LightModel
extends Object

This is the main class for the Model part of the program. All communcations between the model and controller go through this class. Additionally, this class contains the current Show, ADMXDevice, and ChannelValues.


Field Summary
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 FADE_DOWN_MODE
          These modes relate to the status of specific channels at any given time.
static int FADE_UP_MODE
          These modes relate to the status of specific channels at any given time.
static int FADER_VALUE_MODE
          These modes relate to the status of specific channels at any given time.
static int SUBMASTER_VALUE_MODE
          These modes relate to the status of specific channels at any given time.
 
Constructor Summary
LightModel(ILightModelConnector _connector, ADMXDevice _dmxDevice, Show _show)
          This constructor instaniates the LightModel with a link to the connector, the current dmx device, and the default Show.
 
Method Summary
 void addCue(ACue cue)
          This method adds a new cue to the current show.
 boolean connect()
          This method will tell the view to the connect to the USBDMX.com device.
 void disconnect()
          This method will tell the model to disconnect from the current device, and switch to the dummy DMX device.
 Channel[] getChannels()
          This method will return an array of Channel objects for every channel with a non-zero value.
 Channel[] getChannelsForCue()
          This is a specilized form of getChannels() used when creating new cues.
 short getChannelValue(short address)
          This method returns the value of the given channel address.
 short[] getChannelValues(short[] addresses)
          This method will return the channel values for the given addresses.
 short[] getChannelValues(short startAddress, short endAddress)
          This method returns an array of channel values between, and including, the given addresses.
 String[] getCueNames()
          This method will return an array containing the summary of every cue in the show.
 float getHighestCueNumber()
          This method will return the highest cue number in the show.
 void goToCue(float cueNumber)
          This method will move to a cue without a transition.
 void loadShow(String filename)
          This method will load the saved show back into the program.
 void resetFaderValues()
          This method will reset all the fader values to their defaults, and update the view to reflect this change.
 void saveShow(String filename)
          This method will save the current show to a file.
 void setChannelValue(Channel channel, int source)
          This method will set the channel value to the given value.
 void setChannelValues(Channel[] channels, int source)
          This method will set a series of channel values.
 void transitionToCue(float cueNumber)
          This method initiates the fade to a new cue from the current cue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VALUE_MODE

public static final int DEFAULT_VALUE_MODE
These modes relate to the status of specific channels at any given time. This status decides what the color code around the channel will be.

The DEFAULT_VALUE_MODE is utilized when a channel does not have any value assigned to it, and is simply the default vale of 0.

See Also:
Constant Field Values

FADER_VALUE_MODE

public static final int FADER_VALUE_MODE
These modes relate to the status of specific channels at any given time. This status decides what the color code around the channel will be.

The FADER_VALUE_MODE is utilized when the value on this channel is manually set through the virual faders (or keyboard input).

See Also:
Constant Field Values

CUE_VALUE_MODE

public static final int CUE_VALUE_MODE
These modes relate to the status of specific channels at any given time. This status decides what the color code around the channel will be.

The CUE_VALUE_MODE is utilized when the value on this channel is from the current cue.

See Also:
Constant Field Values

SUBMASTER_VALUE_MODE

public static final int SUBMASTER_VALUE_MODE
These modes relate to the status of specific channels at any given time. This status decides what the color code around the channel will be.

The SUBMASTER_VALUE_MODE is utilized when the current value on this channel is from the submasters.

See Also:
Constant Field Values

FADE_UP_MODE

public static final int FADE_UP_MODE
These modes relate to the status of specific channels at any given time. This status decides what the color code around the channel will be.

The FADE_UP_MODE is utilized when a channel is being faded up in value by a cue transition.

See Also:
Constant Field Values

FADE_DOWN_MODE

public static final int FADE_DOWN_MODE
These modes relate to the status of specific channels at any given time. This status decides what the color code around the channel will be.

The FADE_DOWN_MODE is utilized when a channel is being faded down in value by a cue transition.

See Also:
Constant Field Values
Constructor Detail

LightModel

public LightModel(ILightModelConnector _connector,
                  ADMXDevice _dmxDevice,
                  Show _show)
This constructor instaniates the LightModel with a link to the connector, the current dmx device, and the default Show.

Method Detail

getChannelValue

public short getChannelValue(short address)
This method returns the value of the given channel address.

Parameters:
address - The address whos value will be returned.
Returns:
The value of the given address.

getChannelValues

public short[] getChannelValues(short startAddress,
                                short endAddress)
This method returns an array of channel values between, and including, the given addresses.

Parameters:
startAddress - The first address for which a channel value will be returned.
endAddress - The last address for which a channel value will be returned.
Returns:
The array of channel values of length (endAddress - startAddress + 1). This array will contain the values, in order, of the channels from startAddress to endAddress, including the end points.

getChannelValues

public short[] getChannelValues(short[] addresses)
This method will return the channel values for the given addresses.

Parameters:
addresses - The array of channel addresses.
Returns:
The array of channel values.

getChannels

public Channel[] getChannels()
This method will return an array of Channel objects for every channel with a non-zero value.

Returns:
The array of Channel objects for every channel with a non-zero value.

getChannelsForCue

public Channel[] getChannelsForCue()
This is a specilized form of getChannels() used when creating new cues. In addition to returning all channels with a non-zero value, it will also return channels with a hard-ducked fader value (-100).

Returns:
The array of Channel objects for cue creation.

setChannelValue

public void setChannelValue(Channel channel,
                            int source)
This method will set the channel value to the given value. The channelValues object will be updated, as will the dmxDevice, and then the view will be updated.

Parameters:
channel - The Channel object with the new address, value pair.
source - An int representing the source of this channel value.

setChannelValues

public void setChannelValues(Channel[] channels,
                             int source)
This method will set a series of channel values. First, the channelValues object will be updated, then the channels changed on the dmxDevice. Finally, the view will be refreshed to represent the new values.

Parameters:
channels - The Channel objects with the new address, value pairs.
source - An int value representing the source of these channel values.

addCue

public void addCue(ACue cue)
This method adds a new cue to the current show. It will also update the view to reflect this change, and select this cue as the current cue.


resetFaderValues

public void resetFaderValues()
This method will reset all the fader values to their defaults, and update the view to reflect this change.


getCueNames

public String[] getCueNames()
This method will return an array containing the summary of every cue in the show.

TODO: Rename this method from getCueNames() to getCueSummaries()

Returns:
The string array constaining the summary of every cue in the show.

getHighestCueNumber

public float getHighestCueNumber()
This method will return the highest cue number in the show. This is used to select the default cue value when someone creates a new cue.

Returns:
The highest cue number in the show.

transitionToCue

public void transitionToCue(float cueNumber)
This method initiates the fade to a new cue from the current cue. The values of the current cue and the values of the new cue will be loaded and passed into fadeChannelValues, along with the correct fade times.

Parameters:
cueNumber - The number of the cue to fade to.

goToCue

public void goToCue(float cueNumber)
This method will move to a cue without a transition.

Parameters:
cueNumber - The cue number to go to.

connect

public boolean connect()
This method will tell the view to the connect to the USBDMX.com device.

TODO: This method needs to be redone so that the user can select what device they want to connect to.

Returns:
This method will return true if the model sucsessfully connected to the device, and false otherwise.

disconnect

public void disconnect()
This method will tell the model to disconnect from the current device, and switch to the dummy DMX device.


saveShow

public void saveShow(String filename)
This method will save the current show to a file.

Parameters:
filename - The file name and path to save the show to.

loadShow

public void loadShow(String filename)
This method will load the saved show back into the program. After loading the show, it will update the view and channel values to reflect this change.

Parameters:
filename - The file name and path to load the show from.