Exemplo n.º 1
0
 object ICloneable.Clone()
 {
     ArrayElements elements = (ArrayElements)MemberwiseClone();
     elements.elements = new List<PdfItem>(elements.elements);
     elements.owner = null;
     return elements;
 }
Exemplo n.º 2
0
            object ICloneable.Clone()
            {
                ArrayElements elements = (ArrayElements)MemberwiseClone();

                elements._elements   = new List <PDFItem>(elements._elements);
                elements._ownerArray = null;
                return(elements);
            }
Exemplo n.º 3
0
        private void InitArray()
        {
            var prop = GetProperty();

            if (prop == null)
            {
                return;
            }
            IsArray = prop.isArray;
            if (IsArray)
            {
                for (int i = 0; i < prop.arraySize; i++)
                {
                    ArrayElements.Add(new PersistentSerializedProperty(this, i));
                }
            }
        }
Exemplo n.º 4
0
        public void DeleteArrayElementAt(int index)
        {
            EnsureThisIsArray();
            CheckArraySizeCorruption();

            var prop = GetProperty();

            prop.DeleteArrayElementAtIndex(index);

            //Apply delete
            prop.serializedObject.ApplyModifiedProperties();

            ArrayElements.RemoveAt(index);

            //Rebind relativePath of children
            for (int i = 0; i < prop.arraySize; i++)
            {
                ArrayElements[i].SetArrayIndex(i);
            }
        }
Exemplo n.º 5
0
        public PersistentSerializedProperty InsertArrayElementAt(int index)
        {
            EnsureThisIsArray();
            CheckArraySizeCorruption();

            var prop = GetProperty();

            prop.InsertArrayElementAtIndex(index);

            //Apply insert
            prop.serializedObject.ApplyModifiedProperties();

            var insertedElementProp = new PersistentSerializedProperty(this, "");

            ArrayElements.Insert(index, insertedElementProp);

            //Rebind relativePath of children
            for (int i = 0; i < prop.arraySize; i++)
            {
                ArrayElements[i].SetArrayIndex(i);
            }

            return(insertedElementProp);
        }
Exemplo n.º 6
0
 public void TestMethod1()
 {
     int[] X = { 5, 3, 5, 7, 11, 5 };
     Assert.AreEqual(4, ArrayElements.CountDistinctElements(X));
 }
Exemplo n.º 7
0
 public void TestEachMethod3()
 {
     int[] X = { 10, 10, 10, 10, 10, 10, 10 };
     Assert.AreEqual(1, ArrayElements.CountEachDistinctElements(X));
 }
Exemplo n.º 8
0
 public void TestMethod7()
 {
     int[] X = { 1, 2, 3, 1, 2, 3 };
     Assert.AreEqual(3, ArrayElements.CountDistinctElements(X));
 }
Exemplo n.º 9
0
 public void TestMethod6()
 {
     int[] X = { };
     Assert.AreEqual(0, ArrayElements.CountDistinctElements(X));
 }
Exemplo n.º 10
0
 public void TestMethod4()
 {
     int[] X = { -55, -42, 5, 9, 4, -13, 0, 0, 7 };
     Assert.AreEqual(8, ArrayElements.CountDistinctElements(X));
 }
Exemplo n.º 11
0
 public void TestMethod2()
 {
     int[] X = { 10, 10, 10, 11, 12, 10 };
     Assert.AreEqual(3, ArrayElements.CountDistinctElements(X));
 }