i3.dragos.core.runmode
Class RunMode

java.lang.Object
  extended by i3.dragos.core.runmode.RunMode

public class RunMode
extends java.lang.Object

This class provides methods to evaluate and change the application's run mode. In general, two alternatives for each method is given: One operating on the switch identifier, and another one operating on the switch value. The 'value' in the second case does not refer to the actual state of the switch, but on the value used internally. Users are advised to use the second method, as operations are noticeably faster. Also see the respective method documentation.

Author:
Erhard Weinell <Weinell@cs.rwth-aachen.de>

Constructor Summary
RunMode()
          constructor to initialize the RunMode object.
 
Method Summary
 void disableAll()
          Disables all switches.
 boolean isIDEnabled(byte id)
          Test a run mode switch, given by its identifier.
 boolean isValueEnabled(int value)
          Test a run mode switch, given by its value.
 boolean setIDState(byte id, boolean enable)
          Set a run mode switch to some value, given by its identifier.
 boolean setValueState(int value, boolean enable)
          Set a run mode switch to some value, given by its identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunMode

public RunMode()
constructor to initialize the RunMode object.

Method Detail

isIDEnabled

public boolean isIDEnabled(byte id)
Test a run mode switch, given by its identifier. This operation is quite expensive, consider using isValueEnabled(int) instead, passing a constant holding the switch value. This value can be statically dervied from the identifier by the bit-shift operation 1 << id.

Parameters:
id - switch to test
Returns:
true if the switch is enabled, false otherwise.

isValueEnabled

public boolean isValueEnabled(int value)
Test a run mode switch, given by its value.

Parameters:
value - switch to test
Returns:
true if the switch is enabled, false otherwise.

setIDState

public boolean setIDState(byte id,
                          boolean enable)
Set a run mode switch to some value, given by its identifier. This operation is quite expensive, consider using setValueState(int, boolean) instead, passing a constant holding the switch value. This value can be statically dervied from the identifier by the bit-shift operation 1 << id.

Parameters:
id - switch to set
enable - true to enable the switch, false to disable
Returns:
true if the switch was enabled before this method call, false otherwise.

setValueState

public boolean setValueState(int value,
                             boolean enable)
Set a run mode switch to some value, given by its identifier.

Parameters:
value - switch to set
enable - true to enable the switch, false to disable
Returns:
true if the switch was enabled before this method call, false otherwise.

disableAll

public void disableAll()
Disables all switches.



Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.