Package org.wildfly.common
Class Branch
- java.lang.Object
-
- org.wildfly.common.Branch
-
public final class Branch extends java.lang.Object
Branch probability directives. On JVMs which support these constructs,
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
likely(boolean expr)
Assert that the given expression is likely, which is to say, it will betrue
more than 75% of the time.static boolean
probability(float prob, boolean expr)
Assert that the given expression has the given probability of beingtrue
.static boolean
unlikely(boolean expr)
Assert that the given expression is unlikely, which is to say, it will befalse
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 betrue
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 befalse
more than 99.9% of the time.
-
-
-
Method Detail
-
veryLikely
public static boolean veryLikely(boolean expr)
Assert that the given expression is on the "fast path", which is to say, it will betrue
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 befalse
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 betrue
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 befalse
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 beingtrue
.- Parameters:
prob
- the probability where0.0f ≤ prob ≤ 1.0f
expr
- the expression value- Returns:
- the expression value
-
-