/*
Two wrapper objects are regarded mutatable if they are equal.
422626
@Override
	protected boolean mutatesTo(Object o1, Object o2)
	{
		if (null == o2)
		{
			return false;
		}
		return o1.equals(o2);
	}
52626
private boolean attributeEquals(Object value, Object otherValue) {
        if (value == null && otherValue == null) {
            return true;
        } else if (value == null || otherValue == null) {
            return false;
        } else {
            if (value.getClass().isArray()) {
                return Arrays.equals((Object[]) value, (Object[]) otherValue);
                  
            } else {
                return value.equals(otherValue);
            }
        }
    }
1142509
function makeMutable(v, opts) {
    if (TypeUtils.isNullOrUndefined(v)) {
        return v;
    }
    if (!opts) {
        opts = {};
    }
    return BitmapFactory.makeBitmapMutable(v, opts);
}
63554
function sameType(a, b) {
  a = Object.prototype.toString.call(a);
  b = Object.prototype.toString.call(b);
  return a == b;
}
124848
function (other) {
        assertNotNull(other);

        if (this.count() === 0) {
            this.unionWith(other);
            return;
        }

        else if (other === this) {
            this.clear();
            return;
        }

        // If other is a HashSet, it has unique elements according to its equality comparer,
        // but if they're using different equality comparers, then assumption of uniqueness
        // will fail. So first check if other is a hashset using the same equality comparer;
        // symmetric except is a lot faster if we can assume uniqueness

        if (areEqualityComparersEqual(this, other)) {
            var table = this.table;

            forOf(other, function (element) {
                if (!table.remove(element)) {
                    table.add(element, null);
                }
            });
        }
        else {
            this.symmetricExceptWith(new HashSet(other, this.comparer));
        }
    }
1091746
function cloneObj(a,b) {
  Object.keys(b).forEach(function(k) {
    a[k] = b[k];
  });
  return a;
}
1147845
function mixin(a, b) {
        if (a && b) {
            for (var k in b) {
                if (b.hasOwnProperty(k)) {
                    a[k] = b[k];
                }
            }
        }
        return a;
    }
137100
public boolean equal(final Object o1,
                         final Object o2) {
        if ( o1 instanceof InternalFactHandle ) {
            return ((InternalFactHandle) o1).getId() == ((InternalFactHandle) o2).getId();
        }
        Object left = o1;
        final InternalFactHandle handle = ((InternalFactHandle) o2);

        if ( left == handle.getObject() ) {
            return true;
        } else if ( handle.getTraitType() == TraitTypeEnum.WRAPPED_TRAITABLE ) {
            return left == ( (CoreWrapper) handle.getObject() ).getCore();
        } else {
            return false;
        }
    }
557397
function ( obj, arg ) {
		utility.iterate( arg, function ( v, k ) {
			if ( ( obj[k] instanceof Array ) && ( v instanceof Array ) ) {
				array.merge( obj[k], v );
			}
			else if ( ( obj[k] instanceof Object ) && ( v instanceof Object ) ) {
				utility.iterate( v, function ( x, y ) {
					obj[k][y] = utility.clone( x );
				});
			}
			else {
				obj[k] = utility.clone( v );
			}
		});

		return obj;
	}
33335
public static boolean nullSafeEquals(final Object obj1, final Object obj2) {
        return ((obj1 == null && obj2 == null)
                || (obj1 != null && obj2 != null && obj1.equals(obj2)));
    }
8059
private int compare(Object k1, Object k2) {
        return (mComparator==null ? ((Comparable)k1).compareTo(k2)
                : mComparator.compare(k1, k2));
    }
225149
private ImmutableSubstitution<ImmutableTerm> computeLiftableSubstitution(
            ImmutableSubstitution<? extends ImmutableTerm> selectedSubstitution,
            Optional<Variable> rightProvenanceVariable, ImmutableSet<Variable> leftVariables) {

        ImmutableMap<Variable, ImmutableTerm> newMap;
        if (rightProvenanceVariable.isPresent()) {
            newMap = selectedSubstitution.getImmutableMap().entrySet().stream()
                    .filter(e -> !leftVariables.contains(e.getKey()))
                    .collect(ImmutableCollectors.toMap(
                            Map.Entry::getKey,
                            e -> transformRightSubstitutionValue(e.getValue(), leftVariables,
                                    rightProvenanceVariable.get())));
        }
        else {
            newMap = selectedSubstitution.getImmutableMap().entrySet().stream()
                    .filter(e -> !leftVariables.contains(e.getKey()))
                    .collect(ImmutableCollectors.toMap(
                            Map.Entry::getKey,
                            e -> (ImmutableTerm) e.getValue()));
        }

        return substitutionFactory.getSubstitution(newMap);
    }
1035904
public final static boolean objectEquals(Object a, Object b) {
        return a == null ?
                b == null ? true : false :
                    b == null ? false : a.equals(b);
    }
448901
function mutablePropertyChange(inst, property, value, old, mutableData) {
  let isObject;
  if (mutableData) {
    isObject = (typeof value === 'object' && value !== null);
    // Pull `old` for Objects from temp cache, but treat `null` as a primitive
    if (isObject) {
      old = inst.__dataTemp[property];
    }
  }
  // Strict equality check, but return false for NaN===NaN
  let shouldChange = (old !== value && (old === old || value === value));
  // Objects are stored in temporary cache (cleared at end of
  // turn), which is used for dirty-checking
  if (isObject && shouldChange) {
    inst.__dataTemp[property] = value;
  }
  return shouldChange;
}
1119184
@Override
  public UnionWeight<W> plus(UnionWeight<W> a, UnionWeight<W> b) {
    if (isZero(a)) return b;
    if (isZero(b)) return a;

    ImmutableList.Builder<W> builder = ImmutableList.builder();
    int cursorA = 0;
    int cursorB = 0;

    while (cursorA < a.size() && cursorB < b.size()) {
      W nextA = a.get(cursorA);
      W nextB = b.get(cursorB);

      int compare = ordering.compare(nextA, nextB);
      if (compare < 0) {
        builder.add(nextA);
        cursorA += 1;
      } else if (compare > 0) {
        builder.add(nextB);
        cursorB += 1;
      } else {
        // compare == 0, they are equal, then merge; because a and b are legal UnionWeights already we know they
        // don't have any duplicates so we can increment both
        builder.add(mergeStrategy.merge(nextA, nextB));
        cursorA += 1;
        cursorB += 1;
      }
    }
    for (; cursorA < a.size(); cursorA++) {
      builder.add(a.get(cursorA));
    }
    for (; cursorB < b.size(); cursorB++) {
      builder.add(b.get(cursorB));
    }
    return makeCheckedFrom(builder.build());
  }
827573
function injectableWrapper(obj, provide, injects, isTransientScope) {
    // TODO(@davequick): discuss with @halfspiral whether isTransientScope might just better
    // be an array of Annotations
    var wrappedObject = function wrapOrCreateObject() {
      if(isFunction(obj) && (exists(obj.$provide) || exists(obj.$inject) || provide || injects)){
        var instance = Object.create(obj.prototype);
        return obj.apply(instance,arguments) || instance;
      }
      return obj;
    };
    return _wrapper(obj, wrappedObject, provide, injects, isTransientScope);
  }
1302447
public static boolean bothNullOrEqual(Object a, Object b) {
        return (a == null || b == null) ? (a == b) : a.equals(b);
    }