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); }
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)); }
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); }
internal PreferenceView(GenericItemPreferenceArray arr, int i) { this.i = i; this.arr = arr; }