public Builder withBucketCounts(BucketCounts value) { this.item.label = value.getLabel(); this.item.impressionCounts = value.getImpressionCounts(); this.item.jointActionCounts = value.getJointActionCounts(); this.item.actionCounts = value.getActionCounts(); return this; }
public Builder withBucketCounts(BucketCounts value) { this.item.label = value.getLabel(); this.item.impressionCounts = value.getImpressionCounts(); this.item.jointActionCounts = value.getJointActionCounts(); this.item.actionCounts = value.getActionCounts(); return this; }
/** * {@inheritDoc} */ @Override public ExperimentCounts calculateExperimentCounts(Collection<BucketCounts> bucketsSet) { Map<Bucket.Label, BucketCounts> buckets = new HashMap<>(); for (BucketCounts bucket : bucketsSet) { buckets.put(bucket.getLabel(), bucket); } Counts jointActionCounts = new Counts(0, 0); Counts impressionCounts = new Counts(0, 0); Map<Event.Name, ActionCounts> experimentActionCounts = new HashMap<>(); for (BucketCounts bucket : bucketsSet) { jointActionCounts.addCount(bucket.getJointActionCounts()); impressionCounts.addCount(bucket.getImpressionCounts()); Map<Event.Name, ActionCounts> bucketActionCounts = bucket.getActionCounts(); for (ActionCounts bucketCounts : bucketActionCounts.values()) { Event.Name actionName = bucketCounts.getActionName(); ActionCounts currentExperimentCounts = experimentActionCounts.get(actionName); if (currentExperimentCounts == null) { experimentActionCounts.put(actionName, bucketCounts.clone()); } else { currentExperimentCounts.addCount(bucketCounts); } } } return new ExperimentCounts.Builder().withActionCounts(experimentActionCounts).withBuckets(buckets) .withImpressionCounts(impressionCounts).withJointActionCounts(jointActionCounts) .build(); }