コード例 #1
0
ファイル: DicomObjectArray.cs プロジェクト: hksonngan/Xian
        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);
        }
コード例 #2
0
 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));
 }
コード例 #3
0
ファイル: DicomObjectArray.cs プロジェクト: hksonngan/Xian
        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);
        }
コード例 #4
0
ファイル: DicomObjectArray.cs プロジェクト: hksonngan/Xian
 public bool Equals(DicomObjectArray <T> other)
 {
     return(this.CompareTo(other) == 0);
 }
コード例 #5
0
ファイル: DicomObjectArray.cs プロジェクト: hksonngan/Xian
 public int CompareTo(DicomObjectArray <T> other)
 {
     return(Compare(this, other, CompareElement));
 }
コード例 #6
0
ファイル: DicomObjectArray.cs プロジェクト: hksonngan/Xian
 public static int Compare(DicomObjectArray <T> x, DicomObjectArray <T> y)
 {
     return(Compare(x, y, CompareElement));
 }
コード例 #7
0
 public int CompareLexically(IStudyItem x, IStudyItem y)
 {
     return(DicomObjectArray <string> .Compare(this.GetTypedValue(x), this.GetTypedValue(y)));
 }