Class Branch

java.lang.Object
org.wildfly.common.Branch

public final class Branch extends Object
Branch probability directives. On JVMs which support these constructs,
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    likely(boolean expr)
    Assert that the given expression is likely, which is to say, it will be true more than 75% of the time.
    static boolean
    probability(float prob, boolean expr)
    Assert that the given expression has the given probability of being true.
    static boolean
    unlikely(boolean expr)
    Assert that the given expression is unlikely, which is to say, it will be false more than 75% of the time.
    static boolean
    veryLikely(boolean expr)
    Assert that the given expression is on the "fast path", which is to say, it will be true more than 99.9% of the time.
    static boolean
    veryUnlikely(boolean expr)
    Assert that the given expression is on the "slow path", which is to say, it will be false more than 99.9% of the time.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • veryLikely

      public static boolean veryLikely(boolean expr)
      Assert that the given expression is on the "fast path", which is to say, it will be true more than 99.9% of the time.
      Parameters:
      expr - the expression value
      Returns:
      the expression value
    • veryUnlikely

      public static boolean veryUnlikely(boolean expr)
      Assert that the given expression is on the "slow path", which is to say, it will be false more than 99.9% of the time.
      Parameters:
      expr - the expression value
      Returns:
      the expression value
    • likely

      public static boolean likely(boolean expr)
      Assert that the given expression is likely, which is to say, it will be true more than 75% of the time.
      Parameters:
      expr - the expression value
      Returns:
      the expression value
    • unlikely

      public static boolean unlikely(boolean expr)
      Assert that the given expression is unlikely, which is to say, it will be false more than 75% of the time.
      Parameters:
      expr - the expression value
      Returns:
      the expression value
    • probability

      public static boolean probability(float prob, boolean expr)
      Assert that the given expression has the given probability of being true.
      Parameters:
      prob - the probability where 0.0f ≤ prob ≤ 1.0f
      expr - the expression value
      Returns:
      the expression value