private Experiment(Experiment toCopy) {
this.owner = toCopy.owner;
this.name = toCopy.name;
this.treatments = Maps.newConcurrentMap();
for (final Treatment treatment : toCopy.getTreatments()) {
this.treatments.put(treatment.getName(), new Treatment(treatment.getName(), treatment.getDescription()));
}
final List<Allocation> allocations = Lists.newArrayList();
for (final Allocation allocation : toCopy.getAllocations()) {
final Treatment treatment = this.treatments.get(allocation.getTreatment().getName());
allocations.add(new Allocation(treatment, allocation.getOffset(), allocation.getSize()));
}
this.allocations = new Allocations(allocations);
this.overrides = Maps.newConcurrentMap();
for (final TreatmentOverride override : toCopy.getOverrides()) {
final Treatment treatment = this.treatments.get(override.getTreatment().getName());
final TreatmentOverride newOverride = new TreatmentOverride(override.getName(), override.getFilter(), treatment);
overrides.put(override.getName(), newOverride);
}
this.seed = toCopy.seed;
this.description = toCopy.description;
this.filter = toCopy.filter;
this.hashAttributes = Sets.newLinkedHashSet(toCopy.getHashAttributes());
this.active = toCopy.active;
this.created = toCopy.created;
this.modified = toCopy.modified;
this.activated = toCopy.activated;
this.deactivated = toCopy.deactivated;
}