コード例 #1
0
        private static PreferenceArray cloneAndMergeInto(PreferenceArray delegatePrefs, long itemID, long newUserID, float value)
        {
            int             num4;
            int             num   = (delegatePrefs == null) ? 0 : delegatePrefs.length();
            int             size  = num + 1;
            PreferenceArray array = new GenericItemPreferenceArray(size);

            array.setItemID(0, itemID);
            int i = 0;

            while ((i < num) && (newUserID > delegatePrefs.getUserID(i)))
            {
                i++;
            }
            for (num4 = 0; num4 < i; num4++)
            {
                array.setUserID(num4, delegatePrefs.getUserID(num4));
                array.setValue(num4, delegatePrefs.getValue(num4));
            }
            array.setUserID(i, newUserID);
            array.setValue(i, value);
            for (num4 = i + 1; num4 < size; num4++)
            {
                array.setUserID(num4, delegatePrefs.getUserID(num4 - 1));
                array.setValue(num4, delegatePrefs.getValue(num4 - 1));
            }
            return(array);
        }
コード例 #2
0
        public override bool Equals(object other)
        {
            if (!(other is GenericItemPreferenceArray))
            {
                return(false);
            }
            GenericItemPreferenceArray array = (GenericItemPreferenceArray)other;

            return(((this.id == array.id) && this.ids.SequenceEqual <long>(array.ids)) && this.values.SequenceEqual <float>(array.values));
        }
コード例 #3
0
        public override PreferenceArray getPreferencesForItem(long itemID)
        {
            int num;

            if (this.tempPrefs.Count == 0)
            {
                return(base.getDelegate().getPreferencesForItem(itemID));
            }
            PreferenceArray array = null;

            try
            {
                array = base.getDelegate().getPreferencesForItem(itemID);
            }
            catch (NoSuchItemException)
            {
            }
            List <Preference> list = new List <Preference>();

            foreach (KeyValuePair <long, PreferenceArray> pair in this.tempPrefs)
            {
                PreferenceArray array2 = pair.Value;
                num = 0;
                while (num < array2.length())
                {
                    if (array2.getItemID(num) == itemID)
                    {
                        list.Add(array2.get(num));
                    }
                    num++;
                }
            }
            int             num2   = (array == null) ? 0 : array.length();
            int             count  = list.Count;
            int             num4   = 0;
            PreferenceArray array3 = new GenericItemPreferenceArray(num2 + count);

            for (num = 0; num < num2; num++)
            {
                array3.set(num4++, array.get(num));
            }
            foreach (Preference preference in list)
            {
                array3.set(num4++, preference);
            }
            if (array3.length() == 0)
            {
                throw new NoSuchItemException(itemID);
            }
            return(array3);
        }
コード例 #4
0
 internal PreferenceView(GenericItemPreferenceArray arr, int i)
 {
     this.i   = i;
     this.arr = arr;
 }