uk.ac.imperial.ph.hep.command
Class DaqCmdParamOnOff

java.lang.Object
  extended by uk.ac.imperial.ph.hep.command.DaqCmdParamOnOff
All Implemented Interfaces:
DaqCmdParam

public class DaqCmdParamOnOff
extends java.lang.Object
implements DaqCmdParam

This class represents a DaqCmdParameter which is either on or off. The off behaviour is taken to be the default. getExecString() will return the default flag. Check using isUnaltered() whether the command is set to its default value or not.

Author:
Jamie Ballin, HEP, Imperial College London

Constructor Summary
DaqCmdParamOnOff(java.lang.String def, java.lang.String on)
          Initialise a CmdParam which only takes on/off values.
DaqCmdParamOnOff(java.lang.String def, java.lang.String on, java.lang.String description)
           
 
Method Summary
 java.lang.String getDescription()
           
 java.lang.String getExecString()
           
 boolean isEnabled()
          Returns true if this parameter is enabled.
 boolean isUnaltered()
          Returns true if the execString equals the offString.
 void reset()
          Reinitialise the paramter, and reenable it.
 void setEnabled(boolean enabled)
          Call this passing in false if you want the parameter to be ignored.
 void setOff()
          Sets this parameter to be its default value.
 void setOn()
          Sets this parameter to be its non-default value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaqCmdParamOnOff

public DaqCmdParamOnOff(java.lang.String def,
                        java.lang.String on)
Initialise a CmdParam which only takes on/off values.

Parameters:
def - - the value by default, i.e. when NOT explicitly specified.
on - - the value when specified.

DaqCmdParamOnOff

public DaqCmdParamOnOff(java.lang.String def,
                        java.lang.String on,
                        java.lang.String description)
Method Detail

setOff

public void setOff()
Description copied from interface: DaqCmdParam
Sets this parameter to be its default value.

Specified by:
setOff in interface DaqCmdParam

setOn

public void setOn()
Description copied from interface: DaqCmdParam
Sets this parameter to be its non-default value.

Specified by:
setOn in interface DaqCmdParam

getExecString

public java.lang.String getExecString()
Specified by:
getExecString in interface DaqCmdParam
Returns:
the string the parameter would append.

isUnaltered

public boolean isUnaltered()
Returns true if the execString equals the offString.

Specified by:
isUnaltered in interface DaqCmdParam
Returns:
true if the parameter has not altered from its original default state.

reset

public void reset()
Description copied from interface: DaqCmdParam
Reinitialise the paramter, and reenable it.

Specified by:
reset in interface DaqCmdParam

isEnabled

public boolean isEnabled()
Description copied from interface: DaqCmdParam
Returns true if this parameter is enabled.

Specified by:
isEnabled in interface DaqCmdParam
Returns:

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: DaqCmdParam
Call this passing in false if you want the parameter to be ignored.

Specified by:
setEnabled in interface DaqCmdParam

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface DaqCmdParam
Returns:
a short one-line description of what this parameter does.