Beispiel #1
0
        public OclSequence reverse()
        {
            OclSequence newList = new OclSequence(elementType, list);

            newList.list.Reverse();
            return(newList);
        }
Beispiel #2
0
        public OclSequence prepend <T>(OclClassifier newElementType, T item) where T : OclAny
        {
            OclSequence newList = new OclSequence(newElementType, list);

            newList.list.Insert(0, item);
            return(newList);
        }
Beispiel #3
0
        public OclSequence append <T>(OclClassifier newElementType, T item) where T : OclAny
        {
            OclSequence newList = new OclSequence(newElementType, list);

            newList.list.Add(item);
            return(newList);
        }
Beispiel #4
0
        public OclSequence flattenToSequence()
        {
            OclSequence seq = new OclSequence(OclCollectionType.BasicElementType(elementType));

            FlattenToList(seq.list, OclCollectionType.Depth(elementType));
            return(seq);
        }
Beispiel #5
0
        public OclSequence union(OclClassifier newElementType, OclSequence s)
        {
            OclSequence newList = new OclSequence(newElementType, list);

            newList.list.AddRange(s);
            return(newList);
        }
Beispiel #6
0
        public OclSequence insertAt <T>(OclClassifier newElementType, OclInteger index, T item) where T : OclAny
        {
            OclSequence newList  = new OclSequence(newElementType, list);
            int         intIndex = (int)index;

            newList.list.Insert(intIndex - 1, item);
            return(newList);
        }
Beispiel #7
0
        public OclSequence excluding <T>(T item) where T : OclAny
        {
            OclSequence newList = new OclSequence(elementType);

            foreach (OclAny i in list)
            {
                if (!i.Equals(item))
                {
                    newList.list.Add(i);
                }
            }
            return(newList);
        }
Beispiel #8
0
        public OclSequence subSequence(OclInteger start, OclInteger end)
        {
            int intStart = (int)start, intEnd = (int)end;

            if (intEnd < intStart || intStart < 1 || intEnd > list.Count)
            {
                throw new IndexOutOfRangeException();
            }

            OclSequence newList = new OclSequence(elementType);

            for (int i = intStart - 1; i < intEnd; ++i)
            {
                newList.list.Add(list[i]);
            }
            return(newList);
        }
Beispiel #9
0
        public OclSequence characters()
        {
            OclSequence seq = new OclSequence(OclString.Type);

            for (int ptr = 0; ptr < value.Length; ++ptr)
            {
                if (CheckSurrogatePair(value, value.Length, ptr))
                {
                    seq.list.Add(new OclString(value.Substring(ptr, 2)));
                    ++ptr;
                }
                else
                {
                    seq.list.Add(new OclString(value[ptr]));
                }
            }
            return(seq);
        }