Class RelaySim


  • public class RelaySim
    extends Object
    Class to control a simulated relay.
    • Constructor Detail

      • RelaySim

        public RelaySim​(Relay relay)
        Constructs from a Relay object.
        Parameters:
        relay - Relay to simulate
      • RelaySim

        public RelaySim​(int channel)
        Constructs from a relay channel number.
        Parameters:
        channel - Channel number
    • Method Detail

      • registerInitializedForwardCallback

        public CallbackStore registerInitializedForwardCallback​(NotifyCallback callback,
                                                                boolean initialNotify)
        Register a callback to be run when the forward direction is initialized.
        Parameters:
        callback - the callback
        initialNotify - whether to run the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getInitializedForward

        public boolean getInitializedForward()
        Check whether the forward direction has been initialized.
        Returns:
        true if initialized
      • setInitializedForward

        public void setInitializedForward​(boolean initializedForward)
        Define whether the forward direction has been initialized.
        Parameters:
        initializedForward - whether this object is initialized
      • registerInitializedReverseCallback

        public CallbackStore registerInitializedReverseCallback​(NotifyCallback callback,
                                                                boolean initialNotify)
        Register a callback to be run when the reverse direction is initialized.
        Parameters:
        callback - the callback
        initialNotify - whether to run the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getInitializedReverse

        public boolean getInitializedReverse()
        Check whether the reverse direction has been initialized.
        Returns:
        true if initialized
      • setInitializedReverse

        public void setInitializedReverse​(boolean initializedReverse)
        Define whether the reverse direction has been initialized.
        Parameters:
        initializedReverse - whether this object is initialized
      • registerForwardCallback

        public CallbackStore registerForwardCallback​(NotifyCallback callback,
                                                     boolean initialNotify)
        Register a callback to be run when the forward direction changes state.
        Parameters:
        callback - the callback
        initialNotify - whether to run the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getForward

        public boolean getForward()
        Check whether the forward direction is active.
        Returns:
        true if active
      • setForward

        public void setForward​(boolean forward)
        Set whether the forward direction is active.
        Parameters:
        forward - true to make active
      • registerReverseCallback

        public CallbackStore registerReverseCallback​(NotifyCallback callback,
                                                     boolean initialNotify)
        Register a callback to be run when the reverse direction changes state.
        Parameters:
        callback - the callback
        initialNotify - whether to run the callback with the initial state
        Returns:
        the CallbackStore object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
      • getReverse

        public boolean getReverse()
        Check whether the reverse direction is active.
        Returns:
        true if active
      • setReverse

        public void setReverse​(boolean reverse)
        Set whether the reverse direction is active.
        Parameters:
        reverse - true to make active
      • resetData

        public void resetData()
        Reset all simulation data.