Klasse FlowController

java.lang.Object
ch.nolix.core.programcontrol.flowcontrol.FlowController

public final class FlowController extends Object
The FlowController provides methods for flow control. Of the FlowController an instance cannot be created.
Version:
2016-06-01
Autor:
Silvan Wyss
  • Methodendetails

    • asLongAs

      public static IAsLongAsMediator asLongAs(BooleanSupplier condition)
      Parameter:
      condition -
      Gibt zurück:
      a new IAsLongAsMediator with the given condition.
      Löst aus:
      ArgumentIsNullException - if the given condition is null.
    • asSoonAs

      public static IAsSoonAsMediator asSoonAs(BooleanSupplier condition)
      Parameter:
      condition -
      Gibt zurück:
      a new IAsSoonAsMediator with the given condition.
      Löst aus:
      ArgumentIsNullException - if the given condition is null.
    • asSoonAsNoMore

      public static IAsSoonAsMediator asSoonAsNoMore(BooleanSupplier condition)
      Parameter:
      condition -
      Gibt zurück:
      a new IAsSoonAsMediator with the negation of the given condition.
      Löst aus:
      ArgumentIsNullException - if the given condition is null.
    • enqueue

      public static IFuture enqueue(Runnable job)
      Enqueues the given job.
      Parameter:
      job -
      Gibt zurück:
      a IFuture for the given job.
      Löst aus:
      ArgumentIsNullException - if the given job is null.
    • forCount

      public static IForCountMediator forCount(int maxRunCount)
      Parameter:
      maxRunCount -
      Gibt zurück:
      a new IForCountMediator with the given maxRunCount.
      Löst aus:
      NegativeArgumentException - if the given maxRunCount is negative.
    • forMaxMilliseconds

      public static IForMaxMillisecondsMediator forMaxMilliseconds(int maxDurationInMilliseconds)
      Parameter:
      maxDurationInMilliseconds -
      Gibt zurück:
      a new IForMaxMillisecondsMediator for the given maxDurationInMilliseconds.
      Löst aus:
      NegativeArgumentException - if the given maxDurationInMilliseconds is negative.
    • forMaxSeconds

      public static IForMaxMillisecondsMediator forMaxSeconds(int maxDurationInSeconds)
      Parameter:
      maxDurationInSeconds -
      Gibt zurück:
      a new IForMaxMillisecondsMediator for the given maxDurationInSeconds.
      Löst aus:
      NegativeArgumentException - if the given maxDurationInSeconds is negative.
    • runInBackground

      public static IFuture runInBackground(Runnable job)
      Runs the given job in background.
      Parameter:
      job -
      Gibt zurück:
      a new IFuture for the execution of the given job.
      Löst aus:
      ArgumentIsNullException - if the given job is null.
    • runInBackgroundAndOrder

      public static IFuture runInBackgroundAndOrder(Runnable job, Runnable... jobs)
      Runs the given jobs in background in the given order.
      Parameter:
      job -
      jobs -
      Gibt zurück:
      a new IFuture for the running of the given jobs.
    • runInBackground

      public static <R> IResultFuture<R> runInBackground(Supplier<R> resultJob)
      Runs the given result job in background. A result job is a job that returns a result.
      Typparameter:
      R - is the type of the result of the given resultJob.
      Parameter:
      resultJob -
      Gibt zurück:
      a new IResultFuture for the execution of the given resultJob.
      Löst aus:
      ArgumentIsNullException - if the given resultJob is null.
    • runInEnclosedMode

      public static void runInEnclosedMode(Runnable job)
      Runs the given job in an enclosed mode. Prints out the stack trace of any occurring error. An error will occur it the given job is null or if the given job will not run properly.
      Parameter:
      job -
    • runInEnclosedModeAndGetSuccessFlag

      public static boolean runInEnclosedModeAndGetSuccessFlag(Runnable job)
      Runs the given job in an enclosed mode. Prints out the stack trace of any occurring error. An error will occur it the given job is null or if the given job will not run properly.
      Parameter:
      job -
      Gibt zurück:
      true if the given job runs successfully, false otherwise.
    • until

      public static IAsLongAsMediator until(BooleanSupplier condition)
      Parameter:
      condition -
      Gibt zurück:
      a new IAsLongAsMediator for the negation of the given condition.
      Löst aus:
      ArgumentIsNullException - if the given condition is null.
    • waitAsLongAs

      public static IWaitMediator waitAsLongAs(BooleanSupplier condition)
      Waits as long as the given condition is fulfilled.
      Parameter:
      condition -
      Gibt zurück:
      a IWaitMediator.
      Löst aus:
      ArgumentIsNullException - if the given condition is null.
    • waitForMilliseconds

      public static IWaitMediator waitForMilliseconds(int durationInMilliseconds)
      Waits for the given durationInMilliseconds.
      Parameter:
      durationInMilliseconds -
      Gibt zurück:
      a new IWaitMediator.
      Löst aus:
      NegativeArgumentException - if the given durationInMilliseconds is negative.
    • waitForSeconds

      public static IWaitMediator waitForSeconds(int durationInSeconds)
      Waits for the given durationInSeconds.
      Parameter:
      durationInSeconds -
      Gibt zurück:
      a new IWaitMediator.
      Löst aus:
      NegativeArgumentException - if the given durationInSeconds is negative.
    • waitUntil

      public static IWaitMediator waitUntil(BooleanSupplier condition)
      Waits until the given condition is fulfilled.
      Parameter:
      condition -
      Gibt zurück:
      a new IWaitMediator.
      Löst aus:
      ArgumentIsNullException - if the given condition is null.