@@ -154,13 +154,13 @@ private static bool ContextMatchesRule<_, __>(EvaluationContext<_, __> context,
154154 else
155155 switch ( rule . Type )
156156 {
157- case SegmentRuleType . All :
157+ case TypeEnum . All :
158158 matchesConditions = rule . Conditions . All ( condition => ContextMatchesCondition ( context , condition , segmentKey ) ) ;
159159 break ;
160- case SegmentRuleType . Any :
160+ case TypeEnum . Any :
161161 matchesConditions = rule . Conditions . Any ( condition => ContextMatchesCondition ( context , condition , segmentKey ) ) ;
162162 break ;
163- case SegmentRuleType . None :
163+ case TypeEnum . None :
164164 matchesConditions = ! rule . Conditions . Any ( condition => ContextMatchesCondition ( context , condition , segmentKey ) ) ;
165165 break ;
166166 default :
@@ -177,7 +177,7 @@ private static bool ContextMatchesCondition<_, __>(EvaluationContext<_, __> cont
177177
178178 switch ( condition . Operator )
179179 {
180- case SegmentConditionOperator . In :
180+ case Operator . In :
181181 if ( contextValue == null || contextValue . GetType ( ) == typeof ( bool ) )
182182 return false ;
183183 HashSet < string > inValues ;
@@ -198,7 +198,7 @@ private static bool ContextMatchesCondition<_, __>(EvaluationContext<_, __> cont
198198 }
199199 return inValues . Contains ( contextValue . ToString ( ) ) ;
200200
201- case SegmentConditionOperator . PercentageSplit :
201+ case Operator . PercentageSplit :
202202 List < string > objectIds ;
203203
204204 if ( contextValue != null )
@@ -221,10 +221,10 @@ private static bool ContextMatchesCondition<_, __>(EvaluationContext<_, __> cont
221221
222222 return Hashing . GetHashedPercentageForObjectIds ( objectIds ) <= floatConditionValue ;
223223
224- case SegmentConditionOperator . IsNotSet :
224+ case Operator . IsNotSet :
225225 return contextValue == null ;
226226
227- case SegmentConditionOperator . IsSet :
227+ case Operator . IsSet :
228228 return contextValue != null ;
229229
230230 default :
@@ -302,11 +302,11 @@ private static bool MatchesContextValue(object contextValue, Condition condition
302302 {
303303 switch ( condition . Operator )
304304 {
305- case SegmentConditionOperator . NotContains :
305+ case Operator . NotContains :
306306 return ! contextValue . ToString ( ) . Contains ( condition . Value . String ) ;
307- case SegmentConditionOperator . Regex :
307+ case Operator . Regex :
308308 return Regex . Match ( contextValue . ToString ( ) , condition . Value . String ) . Success ;
309- case SegmentConditionOperator . Modulo :
309+ case Operator . Modulo :
310310 return EvaluateModulo ( contextValue . ToString ( ) , condition . Value . String ) ;
311311 default :
312312 return MatchingFunctionName ( contextValue , condition ) ;
@@ -359,9 +359,9 @@ private static bool StringOperations(string contextValue, Condition condition)
359359
360360 switch ( condition . Operator )
361361 {
362- case SegmentConditionOperator . Equal : return contextValue == conditionValue ;
363- case SegmentConditionOperator . NotEqual : return contextValue != conditionValue ;
364- case SegmentConditionOperator . Contains : return contextValue . Contains ( conditionValue ) ;
362+ case Operator . Equal : return contextValue == conditionValue ;
363+ case Operator . NotEqual : return contextValue != conditionValue ;
364+ case Operator . Contains : return contextValue . Contains ( conditionValue ) ;
365365 default : throw new ArgumentException ( "Invalid Operator" ) ;
366366 }
367367 }
@@ -379,12 +379,12 @@ private static bool LongOperations(long contextValue, Condition condition)
379379 }
380380 switch ( condition . Operator )
381381 {
382- case SegmentConditionOperator . Equal : return contextValue == conditionValue ;
383- case SegmentConditionOperator . NotEqual : return contextValue != conditionValue ;
384- case SegmentConditionOperator . GreaterThan : return contextValue > conditionValue ;
385- case SegmentConditionOperator . GreaterThanInclusive : return contextValue >= conditionValue ;
386- case SegmentConditionOperator . LessThan : return contextValue < conditionValue ;
387- case SegmentConditionOperator . LessThanInclusive : return contextValue <= conditionValue ;
382+ case Operator . Equal : return contextValue == conditionValue ;
383+ case Operator . NotEqual : return contextValue != conditionValue ;
384+ case Operator . GreaterThan : return contextValue > conditionValue ;
385+ case Operator . GreaterThanInclusive : return contextValue >= conditionValue ;
386+ case Operator . LessThan : return contextValue < conditionValue ;
387+ case Operator . LessThanInclusive : return contextValue <= conditionValue ;
388388 default : throw new ArgumentException ( "Invalid Operator" ) ;
389389 }
390390 }
@@ -393,12 +393,12 @@ private static bool IntOperations(long contextValue, Condition condition)
393393 {
394394 switch ( condition . Operator )
395395 {
396- case SegmentConditionOperator . Equal : return contextValue == InvariantConvert . ToInt32 ( condition . Value . String ) ;
397- case SegmentConditionOperator . NotEqual : return contextValue != InvariantConvert . ToInt32 ( condition . Value . String ) ;
398- case SegmentConditionOperator . GreaterThan : return contextValue > InvariantConvert . ToInt32 ( condition . Value . String ) ;
399- case SegmentConditionOperator . GreaterThanInclusive : return contextValue >= InvariantConvert . ToInt32 ( condition . Value . String ) ;
400- case SegmentConditionOperator . LessThan : return contextValue < InvariantConvert . ToInt32 ( condition . Value . String ) ;
401- case SegmentConditionOperator . LessThanInclusive : return contextValue <= InvariantConvert . ToInt32 ( condition . Value . String ) ;
396+ case Operator . Equal : return contextValue == InvariantConvert . ToInt32 ( condition . Value . String ) ;
397+ case Operator . NotEqual : return contextValue != InvariantConvert . ToInt32 ( condition . Value . String ) ;
398+ case Operator . GreaterThan : return contextValue > InvariantConvert . ToInt32 ( condition . Value . String ) ;
399+ case Operator . GreaterThanInclusive : return contextValue >= InvariantConvert . ToInt32 ( condition . Value . String ) ;
400+ case Operator . LessThan : return contextValue < InvariantConvert . ToInt32 ( condition . Value . String ) ;
401+ case Operator . LessThanInclusive : return contextValue <= InvariantConvert . ToInt32 ( condition . Value . String ) ;
402402 default : throw new ArgumentException ( "Invalid Operator" ) ;
403403 }
404404 }
@@ -407,12 +407,12 @@ private static bool DoubleOperations(double contextValue, Condition condition)
407407 {
408408 switch ( condition . Operator )
409409 {
410- case SegmentConditionOperator . Equal : return contextValue == InvariantConvert . ToDouble ( condition . Value . String ) ;
411- case SegmentConditionOperator . NotEqual : return contextValue != InvariantConvert . ToDouble ( condition . Value . String ) ;
412- case SegmentConditionOperator . GreaterThan : return contextValue > InvariantConvert . ToDouble ( condition . Value . String ) ;
413- case SegmentConditionOperator . GreaterThanInclusive : return contextValue >= InvariantConvert . ToDouble ( condition . Value . String ) ;
414- case SegmentConditionOperator . LessThan : return contextValue < InvariantConvert . ToDouble ( condition . Value . String ) ;
415- case SegmentConditionOperator . LessThanInclusive : return contextValue <= InvariantConvert . ToDouble ( condition . Value . String ) ;
410+ case Operator . Equal : return contextValue == InvariantConvert . ToDouble ( condition . Value . String ) ;
411+ case Operator . NotEqual : return contextValue != InvariantConvert . ToDouble ( condition . Value . String ) ;
412+ case Operator . GreaterThan : return contextValue > InvariantConvert . ToDouble ( condition . Value . String ) ;
413+ case Operator . GreaterThanInclusive : return contextValue >= InvariantConvert . ToDouble ( condition . Value . String ) ;
414+ case Operator . LessThan : return contextValue < InvariantConvert . ToDouble ( condition . Value . String ) ;
415+ case Operator . LessThanInclusive : return contextValue <= InvariantConvert . ToDouble ( condition . Value . String ) ;
416416 default : throw new ArgumentException ( "Invalid Operator" ) ;
417417 }
418418 }
@@ -421,8 +421,8 @@ private static bool BoolOperations(bool contextValue, Condition condition)
421421 {
422422 switch ( condition . Operator )
423423 {
424- case SegmentConditionOperator . Equal : return contextValue == ToBoolean ( condition . Value . String ) ;
425- case SegmentConditionOperator . NotEqual : return contextValue != ToBoolean ( condition . Value . String ) ;
424+ case Operator . Equal : return contextValue == ToBoolean ( condition . Value . String ) ;
425+ case Operator . NotEqual : return contextValue != ToBoolean ( condition . Value . String ) ;
426426 default : throw new ArgumentException ( "Invalid Operator" ) ;
427427 }
428428 }
@@ -437,12 +437,12 @@ private static bool SemVerOperations(string contextValue, Condition condition)
437437
438438 switch ( condition . Operator )
439439 {
440- case SegmentConditionOperator . Equal : return contextValueAsVersion == conditionValueAsVersion ;
441- case SegmentConditionOperator . NotEqual : return contextValueAsVersion != conditionValueAsVersion ;
442- case SegmentConditionOperator . GreaterThan : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) > 0 ;
443- case SegmentConditionOperator . GreaterThanInclusive : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) >= 0 ;
444- case SegmentConditionOperator . LessThan : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) < 0 ;
445- case SegmentConditionOperator . LessThanInclusive : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) <= 0 ;
440+ case Operator . Equal : return contextValueAsVersion == conditionValueAsVersion ;
441+ case Operator . NotEqual : return contextValueAsVersion != conditionValueAsVersion ;
442+ case Operator . GreaterThan : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) > 0 ;
443+ case Operator . GreaterThanInclusive : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) >= 0 ;
444+ case Operator . LessThan : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) < 0 ;
445+ case Operator . LessThanInclusive : return contextValueAsVersion . ComparePrecedenceTo ( conditionValueAsVersion ) <= 0 ;
446446 default : throw new ArgumentException ( "Invalid Operator" ) ;
447447 }
448448 }
0 commit comments