@@ -68,7 +68,7 @@ public static ParsedSplit createParsedSplitForTests(
6868 flagSets ,
6969 impressionsDisabled ,
7070 prerequisitesMatcher ,
71- buildTargetingRule (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName ,
71+ TargetingRuleFactory . buildTargetingRule (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName ,
7272 changeNumber , 100 , seed , algo , null , flagSets , impressionsDisabled , prerequisitesMatcher )
7373 );
7474 }
@@ -102,7 +102,7 @@ public static ParsedSplit createParsedSplitForTests(
102102 flagSets ,
103103 impressionsDisabled ,
104104 prerequisitesMatcher ,
105- buildTargetingRule (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName ,
105+ TargetingRuleFactory . buildTargetingRule (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName ,
106106 changeNumber , 100 , seed , algo , configurations , flagSets , impressionsDisabled , prerequisitesMatcher )
107107 );
108108 }
@@ -126,7 +126,7 @@ public ParsedSplit(
126126 this (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName , changeNumber ,
127127 trafficAllocation , trafficAllocationSeed , algo , configurations , flagSets ,
128128 impressionsDisabled , prerequisitesMatcher ,
129- buildTargetingRule (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName ,
129+ TargetingRuleFactory . buildTargetingRule (feature , seed , killed , defaultTreatment , matcherAndSplits , trafficTypeName ,
130130 changeNumber , trafficAllocation , trafficAllocationSeed , algo , configurations ,
131131 flagSets , impressionsDisabled , prerequisitesMatcher ));
132132 }
@@ -284,39 +284,6 @@ public String toString() {
284284
285285 }
286286
287- private static TargetingRule buildTargetingRule (
288- String feature , int seed , boolean killed , String defaultTreatment ,
289- List <ParsedCondition > matcherAndSplits , String trafficTypeName , long changeNumber ,
290- int trafficAllocation , int trafficAllocationSeed , int algo ,
291- Map <String , String > configurations , HashSet <String > flagSets ,
292- boolean impressionsDisabled , PrerequisitesMatcher prerequisitesMatcher ) {
293- List <io .split .rules .model .Condition > conditions = matcherAndSplits == null
294- ? Collections .<io .split .rules .model .Condition >emptyList ()
295- : matcherAndSplits .stream ()
296- .map (ParsedSplit ::toTargetingCondition )
297- .collect (Collectors .toList ());
298- List <io .split .rules .model .Prerequisite > prereqs = prerequisitesMatcher == null
299- ? Collections .<io .split .rules .model .Prerequisite >emptyList ()
300- : prerequisitesMatcher .getPrerequisites () == null
301- ? Collections .<io .split .rules .model .Prerequisite >emptyList ()
302- : Collections .unmodifiableList (prerequisitesMatcher .getPrerequisites ());
303- return new TargetingRule (feature , seed , killed , defaultTreatment , conditions , trafficTypeName ,
304- changeNumber , trafficAllocation , trafficAllocationSeed , algo , configurations ,
305- flagSets == null ? new HashSet <>() : flagSets , impressionsDisabled , prereqs );
306- }
307-
308- private static io .split .rules .model .Condition toTargetingCondition (ParsedCondition c ) {
309- List <io .split .rules .model .Partition > partitions = c .partitions () == null
310- ? Collections .<io .split .rules .model .Partition >emptyList ()
311- : c .partitions ().stream ()
312- .map (p -> new io .split .rules .model .Partition (p .treatment , p .size ))
313- .collect (Collectors .toList ());
314- io .split .rules .model .ConditionType condType = c .conditionType () == ConditionType .ROLLOUT
315- ? io .split .rules .model .ConditionType .ROLLOUT
316- : io .split .rules .model .ConditionType .WHITELIST ;
317- return new io .split .rules .model .Condition (condType , c .matcher (), partitions , c .label ());
318- }
319-
320287 public Set <String > getSegmentsNames () {
321288 return parsedConditions ().stream ()
322289 .flatMap (parsedCondition -> parsedCondition .matcher ().attributeMatchers ().stream ())
0 commit comments