public static bool TryParse(string s, ElementParserDelegate elementParser, out DicomObjectArray <T> result) { Platform.CheckForNullReference(elementParser, "elementParser"); if (s != null) { if (s.Length == 0) { result = new DicomObjectArray <T>(); return(true); } List <T> list = new List <T>(); foreach (string elementString in s.Split(new char[] { '\\' }, StringSplitOptions.None)) { T element; if (elementParser(elementString, out element)) { list.Add(element); } else { list.Add(null); } } result = new DicomObjectArray <T>(list); return(true); } result = null; return(false); }
public override bool Parse(string input, out DicomObjectArray <string> output) { return(DicomObjectArray <string> .TryParse( input, delegate(string s, out string result) { result = s; return true; }, out output)); }
public static int Compare(DicomObjectArray <T> x, DicomObjectArray <T> y, Comparison <T> comparer) { if (comparer == null) { return(0); } if (x == null && y == null) { return(0); } if (x == null) { return(-1); } if (y == null) { return(1); } IEnumerator <T> xnumerator = x._values.GetEnumerator(); IEnumerator <T> ynumerator = y._values.GetEnumerator(); int result = 0; do { bool xHasMore = xnumerator.MoveNext(); bool yHasMore = ynumerator.MoveNext(); if (xHasMore ^ yHasMore) { result = xHasMore ? 1 : -1; } else if (xHasMore) // note that yHasMore == xHasMore { result = comparer(xnumerator.Current, ynumerator.Current); } else { result = 0; break; } } while (result == 0); return(result); }
public bool Equals(DicomObjectArray <T> other) { return(this.CompareTo(other) == 0); }
public int CompareTo(DicomObjectArray <T> other) { return(Compare(this, other, CompareElement)); }
public static int Compare(DicomObjectArray <T> x, DicomObjectArray <T> y) { return(Compare(x, y, CompareElement)); }
public int CompareLexically(IStudyItem x, IStudyItem y) { return(DicomObjectArray <string> .Compare(this.GetTypedValue(x), this.GetTypedValue(y))); }