
com.glassdoor.planout4j.ExperimentConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of planout4j-core Show documentation
Show all versions of planout4j-core Show documentation
PlanOut for Java core infrastructure (mostly ported from original PlanOut)
package com.glassdoor.planout4j;
import java.util.Map;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import com.glassdoor.planout4j.util.Helper;
import static com.google.common.base.Preconditions.*;
/**
* Experiment config (aka experiment definition) has a unique (within its namespace) name (referred to as "definition")
* and the script (aka "assign") representing compiled PlanOut DSL instructions to be interpreted at runtime.
* @author ernest.mishkin
*/
public class ExperimentConfig {
public final String definition;
private final Map script;
public ExperimentConfig(final String definition, final Map script) {
checkArgument(StringUtils.isNotEmpty(definition));
this.definition = definition;
checkArgument(MapUtils.isNotEmpty(script));
this.script = script;
}
public final Map getCopyOfScript() {
return Helper.deepCopy(script, null);
}
@Override
public int hashCode() {
return definition.hashCode();
}
@Override
public boolean equals(final Object obj) {
return obj == this ||
obj instanceof ExperimentConfig && definition.equals(((ExperimentConfig)obj).definition);
}
@Override
public String toString() {
return String.format("exp_def[%s]", definition);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy