Lines Matching refs:other

151      * @param other The WorkSource to compare against.
154 public boolean diff(WorkSource other) {
156 if (N != other.mNum) {
160 final int[] uids2 = other.mUids;
162 final String[] names2 = other.mNames;
176 * work source. If <var>other</var> is null, the current work source
179 public void set(WorkSource other) {
180 if (other == null) {
184 mNum = other.mNum;
185 if (other.mUids != null) {
187 System.arraycopy(other.mUids, 0, mUids, 0, mNum);
189 mUids = other.mUids.clone();
191 if (other.mNames != null) {
193 System.arraycopy(other.mNames, 0, mNames, 0, mNum);
195 mNames = other.mNames.clone();
229 public WorkSource[] setReturningDiffs(WorkSource other) {
233 updateLocked(other, true, true);
245 * Merge the contents of <var>other</var> WorkSource in to this one.
247 * @param other The other WorkSource whose contents are to be merged.
250 public boolean add(WorkSource other) {
252 return updateLocked(other, false, false);
257 public WorkSource addReturningNewbs(WorkSource other) {
260 updateLocked(other, false, true);
322 public boolean remove(WorkSource other) {
323 if (mNum <= 0 || other.mNum <= 0) {
326 if (mNames == null && other.mNames == null) {
327 return removeUids(other);
330 throw new IllegalArgumentException("Other " + other + " has names, but target "
333 if (other.mNames == null) {
334 throw new IllegalArgumentException("Target " + this + " has names, but other "
335 + other + " does not");
337 return removeUidsAndNames(other);
357 private boolean removeUids(WorkSource other) {
360 final int N2 = other.mNum;
361 final int[] uids2 = other.mUids;
364 if (DEBUG) Log.d(TAG, "Remove " + other + " from " + this);
366 if (DEBUG) Log.d(TAG, "Step: target @ " + i1 + " of " + N1 + ", other @ " + i2
389 private boolean removeUidsAndNames(WorkSource other) {
393 final int N2 = other.mNum;
394 final int[] uids2 = other.mUids;
395 final String[] names2 = other.mNames;
398 if (DEBUG) Log.d(TAG, "Remove " + other + " from " + this);
400 if (DEBUG) Log.d(TAG, "Step: target @ " + i1 + " of " + N1 + ", other @ " + i2
427 private boolean updateLocked(WorkSource other, boolean set, boolean returnNewbs) {
428 if (mNames == null && other.mNames == null) {
429 return updateUidsLocked(other, set, returnNewbs);
432 throw new IllegalArgumentException("Other " + other + " has names, but target "
435 if (other.mNum > 0 && other.mNames == null) {
436 throw new IllegalArgumentException("Target " + this + " has names, but other "
437 + other + " does not");
439 return updateUidsAndNamesLocked(other, set, returnNewbs);
451 private boolean updateUidsLocked(WorkSource other, boolean set, boolean returnNewbs) {
454 final int N2 = other.mNum;
455 final int[] uids2 = other.mUids;
458 if (DEBUG) Log.d(TAG, "Update " + this + " with " + other + " set=" + set
461 if (DEBUG) Log.d(TAG, "Step: target @ " + i1 + " of " + N1 + ", other @ " + i2
489 // Skip uids that already exist or are not in 'other'.
496 // Remove any uids that don't exist in 'other'.
525 * Returns 0 if equal, negative if 'this' is before 'other', positive if 'this' is after 'other'.
527 private int compare(WorkSource other, int i1, int i2) {
528 final int diff = mUids[i1] - other.mUids[i2];
532 return mNames[i1].compareTo(other.mNames[i2]);
543 private boolean updateUidsAndNamesLocked(WorkSource other, boolean set, boolean returnNewbs) {
544 final int N2 = other.mNum;
545 final int[] uids2 = other.mUids;
546 String[] names2 = other.mNames;
549 if (DEBUG) Log.d(TAG, "Update " + this + " with " + other + " set=" + set
552 if (DEBUG) Log.d(TAG, "Step: target @ " + i1 + " of " + mNum + ", other @ " + i2
555 if (i1 >= mNum || (i2 < N2 && (diff=compare(other, i1, i2)) > 0)) {
574 // Remove any uids that don't exist in 'other'.
584 diff = i2 < N2 ? compare(other, i1, i2) : -1;