private static IWheel GetWheelWithGivenWheelOperations(string descriptionString, IWheel wheel, IEnumerable <IWheelOperation> wheelOperations) { foreach (IWheelOperation operation in wheelOperations) { var pattern = AWheelOperations.GetPattern(descriptionString, operation.GetRegexPattern()); if (pattern.Equals(string.Empty)) { continue; } wheel = operation.SetValueOnWheel(wheel, pattern); descriptionString = AWheelOperations.CutFromString(descriptionString, pattern); } return(wheel); }
public static IArticle GetWheelForDescription(string descriptionString, string description2String) { IWheel wheel = new Wheel(); var heightWidthPattern = AWheelOperations.GetPattern(descriptionString, heightWidthOperation.GetRegexPattern()); if (heightWidthPattern.Equals(string.Empty)) { return(wheel); } wheel = heightWidthOperation.SetValueOnWheel(wheel, heightWidthPattern); descriptionString = AWheelOperations.CutFromString(descriptionString, heightWidthPattern); wheel = GetWheelWithGivenWheelOperations(descriptionString, wheel, wheelsOperations); wheel = GetWheelWithGivenWheelOperations(description2String, wheel, extraWheelsOperations); return(wheel); }