public interface Condition<S extends ExperimentState>
ExperimentState
.
The Condition
interface allows Gertrude clients to specify rules
that determine which experiments and flag value modifiers are active for a
request.
For example, a client could implement a Condition
that tested
whether or not a request was in a particular country, or one based on a
regular expression matching the hostname of the machine running this instance.
Classes that implement the Condition
interface should be registered
with the ConditionFactory
for the current session so that Gertrude can
create new instances of those classes from the information contained in the
serialized version of the current ExperimentSpace
.
Modifier and Type | Interface and Description |
---|---|
static class |
Condition.CacheLevel
An indicator for how often the value of a
Condition will change when the
evaluate(ExperimentState) method is called repeatedly. |
Modifier and Type | Field and Description |
---|---|
static Condition<ExperimentState> |
FALSE
A
Condition instance that is always false. |
static Condition<ExperimentState> |
TRUE
A
Condition instance that is always true. |
Modifier and Type | Method and Description |
---|---|
boolean |
evaluate(S state)
Returns a true or false value for the given
ExperimentState . |
Condition.CacheLevel |
getCacheLevel()
Returns an indication of the level at which this
Condition instance may be
cached. |
void |
initialize(List<String> args)
Initialize this instance with an optional list of arguments provided in
the serialized
ExperimentSpace . |
static final Condition<ExperimentState> TRUE
Condition
instance that is always true.static final Condition<ExperimentState> FALSE
Condition
instance that is always false.void initialize(List<String> args)
ExperimentSpace
.args
- the provided argumentsboolean evaluate(S state)
ExperimentState
.state
- the ExperimentState
that contains information about the requestCondition.CacheLevel getCacheLevel()
Condition
instance may be
cached.Copyright © 2013. All rights reserved.