public static RulEngStore ProcessAllOperationsReducer(RulEngStore previousState, IOpReqProcessing prescription) { // Set up a temporary 'Processing' copy of the Store as our Unit of Work var newState = previousState.DeepClone(); newState = newState.AllOperations(previousState, prescription); return(newState.DeepClone()); }
public static RulEngStore ProcessAllRulesReducer(RulEngStore previousState, IRuleProcessing prescription) { // Set up a temporary 'Processing' copy of the Store as our Unit of Work var newState = previousState.DeepClone(); // First identify rules for entities that may (not) exist newState = newState.AllExists(prescription as ProcessExistsRule); // Then test for meaningful Values newState = newState.AllHasMeaningfulValue(prescription as ProcessHasMeaningfulValueRule); newState = newState.AllCompare(prescription as ProcessLessThanRule, RuleType.LessThan); newState = newState.AllCompare(prescription as ProcessEqualRule, RuleType.Equal); newState = newState.AllCompare(prescription as ProcessGreaterThanRule, RuleType.GreaterThan); newState = newState.AllCompare(prescription as ProcessRegexMatchRule, RuleType.RegularExpression); newState = newState.AllCollection(prescription as ProcessAndRule, RuleType.And); newState = newState.AllCollection(prescription as ProcessOrRule, RuleType.Or); newState = newState.AllCollection(prescription as ProcessXorRule, RuleType.Xor); return(newState.DeepClone()); }