Module wonderful.util.flag

A trapped flag class.

Classes and inheritance

wonderful.util.flag.TrappedFlag A trapped flag class.

Class TrappedFlag

TrappedFlag:__new__(parentFlagGetter, initialFlagValue, initialTrapStatus, arg) Construct a new flag instance.
TrappedFlag:raise([quiet=false]) Raise the flag, and notify the parent of this change unless quiet is true.
TrappedFlag:lower() Lower the flag.
TrappedFlag:isRaised() Check if the flag is raised.
TrappedFlag:isSetOff() Check if the trap is set off.
TrappedFlag:reset() Reset the trap.


Classes and inheritance

wonderful.util.flag.TrappedFlag
A trapped flag class.

Like a usual flag, it stores a boolean value. When the flag is raised, its ascendants are notified of this, and calling their isSetOff method returns true.

Note that, if you lower the flag, its ascendants are not notified of this, and isSetOff keeps returning true until you reset them.

Class TrappedFlag

TrappedFlag:__new__(parentFlagGetter, initialFlagValue, initialTrapStatus, arg)
Construct a new flag instance.

Parameters:

  • parentFlagGetter function(arg) a function that returns the parent flag
  • initialFlagValue boolean the initial flag value
  • initialTrapStatus boolean the initial trap status (true if set off)
  • arg an argument to pass to the parent flag getter
TrappedFlag:raise([quiet=false])
Raise the flag, and notify the parent of this change unless quiet is true.

Parameters:

  • quiet boolean don't notify parent of the change (default false)
TrappedFlag:lower()
Lower the flag.
TrappedFlag:isRaised()
Check if the flag is raised.

Returns:

    boolean
TrappedFlag:isSetOff()
Check if the trap is set off.

Returns:

    boolean
TrappedFlag:reset()
Reset the trap.

This does not lower the flag.

generated by LDoc 1.4.6 Last updated 2019-07-27 21:32:05