Package io.rtr.alchemy.models
Class Experiment
java.lang.Object
io.rtr.alchemy.models.Experiment
- All Implemented Interfaces:
Named
Represents a collection of user experiences being tested
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for building Experiment inside storestatic class -
Field Summary
Fields inherited from interface io.rtr.alchemy.models.Named
NAME_PATTERN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactivate()Activates the experiments, enabling all treatmentsaddOverride(String overrideName, String treatmentName, String filter) Add a treatment override for an identityaddTreatment(String name) Adds a treatmentaddTreatment(String name, String description) Adds a treatmentAllocates bins to a treatmentRemoves all overridesRemoves all treatmentsstatic ExperimentcopyOf(Experiment experiment) Deactivates the experiment, disabling all treatmentsdeallocate(String treatmentName, int size) De-allocates bins from a treatmentRemoves all allocationsvoiddelete()Deletes the experiment and all things associated with itbooleanorg.joda.time.DateTimeGets all allocations defined on this experimentorg.joda.time.DateTimeorg.joda.time.DateTimeorg.joda.time.DateTimegetName()getOverride(String overrideName) Gets the assigned override for a given nameGets all overrides defined on this experimentintgetSeed()getTreatment(Identity identity, AttributesMap attributes) Returns treatment for an identitygetTreatment(String treatmentName) Get a treatment with the given nameGets all treatments defined on this experimentinthashCode()booleanisActive()reallocate(String sourceTreatmentName, String destinationTreatmentName, int size) Reallocates bins from one treatment to anotherremoveOverride(String overrideName) Remove an overrideremoveOverrides(String treatmentName) Removes all overrides for a given treatmentremoveTreatment(String name) Removes a treatmentsave()Saves the experiment and all changes made to itsetDescription(String description) setFilter(FilterExpression filter) setHashAttributes(String... hashAttributes) setHashAttributes(Set<String> hashAttributes) setSeed(int seed) Sets the seed used to compute hashes from identities.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.rtr.alchemy.models.Named
validateName
-
Constructor Details
-
Experiment
-
-
Method Details
-
copyOf
- Throws:
javax.validation.ValidationException
-
getName
-
getDescription
-
setDescription
-
getFilter
-
setFilter
-
getHashAttributes
-
setHashAttributes
-
setHashAttributes
-
getSeed
public int getSeed() -
setSeed
Sets the seed used to compute hashes from identities. WARNING: Changing this value will change what users are assigned to what treatments -
isActive
public boolean isActive() -
getCreated
public org.joda.time.DateTime getCreated() -
getModified
public org.joda.time.DateTime getModified() -
getActivated
public org.joda.time.DateTime getActivated() -
getDeactivated
public org.joda.time.DateTime getDeactivated() -
getAllocations
Gets all allocations defined on this experiment -
getTreatments
Gets all treatments defined on this experiment -
getTreatment
Get a treatment with the given name -
getOverrides
Gets all overrides defined on this experiment -
getOverride
Gets the assigned override for a given name- Parameters:
overrideName- The name
-
activate
Activates the experiments, enabling all treatments -
deactivate
Deactivates the experiment, disabling all treatments -
addTreatment
Adds a treatment- Parameters:
name- The name- Throws:
javax.validation.ValidationException
-
addTreatment
public Experiment addTreatment(String name, String description) throws javax.validation.ValidationException Adds a treatment- Parameters:
name- The namedescription- The description- Throws:
javax.validation.ValidationException
-
clearTreatments
Removes all treatments -
clearOverrides
Removes all overrides -
addOverride
public Experiment addOverride(String overrideName, String treatmentName, String filter) throws javax.validation.ValidationException Add a treatment override for an identity- Parameters:
overrideName- The name of the overridetreatmentName- The treatment an identity should receivefilter- A filter expression that describes which attributes this override should apply for- Throws:
javax.validation.ValidationException
-
removeOverride
Remove an override- Parameters:
overrideName- The name of the override to remove
-
removeOverrides
Removes all overrides for a given treatment- Parameters:
treatmentName- The treatment to remove overrides for
-
removeTreatment
Removes a treatment- Parameters:
name- The treatment
-
save
Saves the experiment and all changes made to it -
delete
public void delete()Deletes the experiment and all things associated with it -
allocate
Allocates bins to a treatment- Parameters:
treatmentName- The treatmentsize- The number of bins
-
deallocate
De-allocates bins from a treatment- Parameters:
treatmentName- The treatmentsize- The number of bins
-
reallocate
Reallocates bins from one treatment to another- Parameters:
sourceTreatmentName- The source treatmentdestinationTreatmentName- The destination treatmentsize- The number of bins
-
deallocateAll
Removes all allocations -
getTreatment
Returns treatment for an identity- Parameters:
identity- The identity- Returns:
- the treatment assigned to given identity
-
equals
-
hashCode
public int hashCode() -
toString
-