public abstract class AbstractPropertyCondition<V,S extends ExperimentState> extends Object implements Condition<S>
Condition
pattern of checking whether or not the value of a field
in an ExperimentState
belongs to a given set of values.
For example, the property might be the country that a request originated in, and the arguments to
the function would be a list of country codes. If the country returned by the #getValue
method
is in the given list of country codes, then the #evaluate
method would return true
.
Condition.CacheLevel
Constructor and Description |
---|
AbstractPropertyCondition() |
Modifier and Type | Method and Description |
---|---|
boolean |
evaluate(S state)
Returns a true or false value for the given
ExperimentState . |
abstract V |
getValue(S state)
Returns the value of the property for the given state.
|
void |
initialize(List<String> args)
Initialize this instance with an optional list of arguments provided in
the serialized
ExperimentSpace . |
protected abstract Set<V> |
parseArgs(List<String> args)
Sub-classes should override this method to validate and extract the information they need to evalate
the state of a given
ExperimentState instance. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCacheLevel
public void initialize(List<String> args)
Condition
ExperimentSpace
.initialize
in interface Condition<S extends ExperimentState>
args
- the provided argumentspublic boolean evaluate(S state)
Condition
ExperimentState
.evaluate
in interface Condition<S extends ExperimentState>
state
- the ExperimentState
that contains information about the requestprotected abstract Set<V> parseArgs(List<String> args)
ExperimentState
instance.args
- the input arguments from the configurationCopyright © 2013. All rights reserved.