public final class DiversionCriterion extends Object implements Comparable<DiversionCriterion>
ExperimentState
into a Segment
defined within the
set of Layer
instances in the current ExperimentSpace
.
For a web application, there may be multiple diversion criteria available, such as a user's login ID, a cookie stored in a browser, or some other attribute of the request, such as a search query. The ids of the diversion critera imply a priority ordering of the criteria (from lowest to highest), so that the diversion rules for a request that contain multiple identifiers (such as both a login ID and a browser cookie) are unambiguous.
It is also possible to define a random diversion criterion that is independent of the request. If one is defined, it should be the lowest priority criteria.
Each criterion (either fixed or random) must have an associated number of buckets available.
Segment
instances claim buckets for a diversion criterion, and ExperimentState
instances are assigned to Segment
instances based on how their identifiers are mapped into
buckets.
See the comments on the ExperimentState.getDiversionIdentifier(int)
method for more
information about working with DiversionCriterion
.
Constructor and Description |
---|
DiversionCriterion(int id,
int numBuckets,
boolean random) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DiversionCriterion other) |
boolean |
equals(Object o) |
int |
getId()
Returns the unique id of this diversion criteria that is referenced in
the definition of a
Segment . |
int |
getNumBuckets()
Returns the number of buckets for this criteria that may be allocated to
Segment instances. |
int |
hashCode() |
boolean |
isRandom()
Returns true if this is a random criteria that is independent of any information about
the request contained in the
ExperimentState . |
public DiversionCriterion(int id, int numBuckets, boolean random)
public int getId()
Segment
.public int getNumBuckets()
Segment
instances.public boolean isRandom()
ExperimentState
.public int compareTo(DiversionCriterion other)
compareTo
in interface Comparable<DiversionCriterion>
Copyright © 2013. All rights reserved.