public static string GetCardinalityString(uint lower, UnlimitedInt upper) { if (lower != upper) { return(String.Format("{0}..{1}", lower, upper)); } else { return(lower.ToString()); } }
public static bool ParseMultiplicityString(string newCardinality, out uint lower, out UnlimitedInt upper) { try { if (newCardinality.Contains("..")) { int pos = newCardinality.IndexOf(".."); lower = ParseUint(newCardinality.Substring(0, pos)); upper = ParseUnlimitedNatural(newCardinality.Substring(pos + 2)); } else { lower = uint.Parse(newCardinality); upper = (UnlimitedInt)lower; } return(true); } catch (FormatException) { lower = 0; upper = 0; return(false); } }
public static bool IsMultiplicityValid(uint?lower, UnlimitedInt upper) { return(!lower.HasValue || lower <= upper); }