public abstract class PermissionBackendCondition extends PrivateInternals_BooleanCondition.SubclassOnlyInCoreServer
BooleanCondition
to evaluate a permission.Modifier and Type | Class and Description |
---|---|
static class |
PermissionBackendCondition.ForChange |
static class |
PermissionBackendCondition.ForProject |
static class |
PermissionBackendCondition.ForRef |
static class |
PermissionBackendCondition.WithUser |
FALSE, TRUE
Constructor and Description |
---|
PermissionBackendCondition() |
Modifier and Type | Method and Description |
---|---|
boolean |
evaluatesTrivially()
Check if the condition evaluates to either
true or false without providing
additional information to the evaluation tree, e.g. |
BooleanCondition |
reduce()
Reduce evaluation tree by cutting off branches that evaluate trivially and replacing them with
a leave note corresponding to the value the branch evaluated to.
|
void |
set(boolean val)
Assign a specific
testOrFalse result to this condition. |
abstract java.lang.String |
toString() |
children
public void set(boolean val)
testOrFalse
result to this condition.
By setting the condition to a specific value the condition will bypass calling PermissionBackend
during value()
, and immediately return the set value instead.
val
- value to return from value()
.public abstract java.lang.String toString()
toString
in class java.lang.Object
public boolean evaluatesTrivially()
BooleanCondition
true
or false
without providing
additional information to the evaluation tree, e.g. through checks to a remote service such as
PermissionBackend
.
In this case, the tree can be reduced to skip all non-trivial checks resulting in a performance gain.
evaluatesTrivially
in class BooleanCondition
public BooleanCondition reduce()
BooleanCondition
Example 1 (T=True, F=False, C=non-trivial check):
OR
/ \ => T
C T
Example 2 (cuts off a not-trivial check):
AND
/ \ => F
C F
Example 3:
AND
/ \ => F
T F
There is no guarantee that the resulting tree is minimal. The only guarantee made is that branches that evaluate trivially will be cut off and replaced by primitive values.
reduce
in class BooleanCondition