ur_rna.Utilities

## Class RunOnce

- java.lang.Object
- - ur_rna.Utilities.RunOnce

- All Implemented Interfaces:
    java.lang.Runnable, RunnableOnce

      public class RunOnce
      extends java.lang.Object
      implements RunnableOnce

  This class operates as a proxy for a `Runnable`. When `run()` is called initially, it is delegated to `Runnable.run()`, and subsequent calls to `run()` are be ignored (i.e. they do not result in a call to `Runnable.run()`). The method `hasRun()` can be used to determine whether or not `run()` has been called. The `reset()` method can be called to re-enable `run()` to make another one-time call to `Runnable.run()`).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `has_run`
    `private java.lang.Runnable` | `inner`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RunOnce()`
    `RunOnce(java.lang.Runnable innerRunnable)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `hasRun()` Indicates whether `run()` has been called.
    `void` | `mockRun()` Fakes a call to run.
    `void` | `reset()` Resets the internal state of the RunnableOnce instance, so `run()` can be called again, even if it has already been called once.
    `void` | `run()` When an object implementing interface `Runnable` is used to create a thread, starting the thread causes the object's `run` method to be called in that separately executing thread.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### has_run

          private boolean has_run

    - #### inner

          private final java.lang.Runnable inner

  - ### Constructor Detail

    - #### RunOnce

          public RunOnce()

    - #### RunOnce

          public RunOnce(java.lang.Runnable innerRunnable)

  - ### Method Detail

    - #### hasRun

          public boolean hasRun()

      Indicates whether `run()` has been called.
      Specified by:
        `hasRun` in interface `RunnableOnce`
      Returns:
        True if `run()` has already been called. This can be reset by a call to `reset()`.

    - #### mockRun

          public void mockRun()

      Fakes a call to run. After calling this, `hasRun()` will return true, but `run()` is never actually called.

    - #### reset

          public void reset()

      Resets the internal state of the RunnableOnce instance, so `run()` can be called again, even if it has already been called once.
      Specified by:
        `reset` in interface `RunnableOnce`

    - #### run

          public void run()

      When an object implementing interface `Runnable` is used to create a thread, starting the thread causes the object's `run` method to be called in that separately executing thread.

      The general contract of the method `run` is that it may take any action whatsoever.

      Specified by:
        `run` in interface `java.lang.Runnable`
      See Also:
        `Thread.run()`