Using the configured comparator (or equals if not configured), determine
if two objects are equal.

@param o1 Object to compare
@param o2 Object to compare
@return boolean true if objects are equal
501669
private boolean equalByComparator(Object o1, Object o2) {
		return comparator == null ? o1.equals(o2) : comparator.compare(o1, o2) == 0;
	}
129897
public int compare(FailOverListener o1, FailOverListener o2) {
		if (o1.equals(o2)) {
			return 0;
		}
		else {
			if (o1.getPriority() > o2.getPriority()) {
				return -1;
			}
			else {
				return 1;
			}
		}
	}
811829
public int compare(T o1, T o2) {
	if(o1 == o2)   return 0;
	String str1 = (o1 == null) ? "null" : o1.toString(); 
	String str2 = (o2 == null) ? "null" : o2.toString();
	return str1.compareTo(str2);
    }
1030449
private boolean checkEquality(E it, Object o) {
		return o.equals(it) || (comparator != null && comparator.compare(it, (E) o) == 0);
	}
1203719
@Override
    public int compare(Integer o1, Integer o2) {
        double diff = dataArray[o2] - dataArray[o1];
        if (diff == 0) {
            return 0;
        }
        if (sortType == ASCENDING) {
            return (diff > 0) ? -1 : 1;
        } else {
            return (diff > 0) ? 1 : -1;
        }
    }
790942
public int compare(CaptureSearchResult o1, CaptureSearchResult o2) {
		String k1 = objectToKey(o1);
		String k2 = objectToKey(o2);
		if(backwards) {
			return k2.compareTo(k1);
		}
		return k1.compareTo(k2);
	}
901341
public boolean equal(final Object o1,
                         Object o2) {
        if ( o1 == o2 ) {
            return true;
            
        }
        // o1 is a FactHandle, so just check their id's are the same
        if ( o1 instanceof FactHandle ) {
            return ((InternalFactHandle)o1).getId() == ((InternalFactHandle)o2).getId() ;
        }

        // o1 is an object, so unwrap o2 for comparison
        final InternalFactHandle handle = ((InternalFactHandle) o2);
        o2 = handle.getObject();
        return o1 == o2 || o2.equals( o1 );
    }
253073
@Override
	public int compare(ResourceGeneratorResolver o1, ResourceGeneratorResolver o2) {
		
		int result = 0;
		if(o1.getType().equals(SUFFIXED) && o2.getType().equals(PREFIXED)){
			result = -1;
		}else if(o1.getType().equals(PREFIXED) && o2.getType().equals(SUFFIXED)){
			result = 1;
		}
		
		return result;
	}
898673
public static boolean objectsNotEqual(final Object one, final Object two) {

        return (one == null) ? (two != null) : (!one.equals(two));

    }
704218
public function compare($object1, $object2)
    {
        if (! self::isCastableToString($object1)) {
            throw new ComparatorException('$object1 (type: ' . gettype($object1) . ') is not castable to string.');
        }
        if (! in_array(gettype($object2), ['string', 'integer', 'double'])) {
            throw new ComparatorException('$object2 (type: ' . gettype($object2) . ') is not castable to string.');
        }
        return call_user_func("\\{$this->compareMode}", $object1, $object2);
    }
940042
public boolean compare(Object o) {
		if (!basicEquals(o))
			return false;

		QueryParameter that = (QueryParameter) o;

		// compare sources to have the same select no matter of letter-case and
		// white spaces
		if (!StringUtil.equalsText(source, that.source))
			return false;
		if (!StringUtil.equalsText(defaultSource, that.defaultSource))
			return false;

		return true;
	}
1284352
@Override
	public int compare(ResourceGenerator o1, ResourceGenerator o2) {
		
		ResolverComparator rComparator = new ResolverComparator();
		return rComparator.compare(o1.getResolver(), o2.getResolver());
	}
1333853
function(o1, o2)
{
   var rval = 0;
   
   if(o1.constructor === String)
   {
      if(o2.constructor !== String)
      {
         rval = -1;
      }
      else
      {
         rval = _compare(o1, o2);
      }
   }
   else if(o2.constructor === String)
   {
      rval = 1;
   }
   else
   {
      rval = _compareObjectKeys(o1, o2, '@literal');
      if(rval === 0)
      {
         if('@literal' in o1)
         {
            rval = _compareObjectKeys(o1, o2, '@type');
            if(rval === 0)
            {
               rval = _compareObjectKeys(o1, o2, '@language');
            }
         }
         // both are '@id' objects
         else
         {
            rval = _compare(o1['@id'], o2['@id']);
         }
      }
   }
   
   return rval;
}
1138617
public function equals($o1, $o2)
    {
        // TODO: handle objects that don't match the schema
        foreach ($this->_props as $key=>$prop) {
            if(!$prop->type->equals($o1->get($key), $o2->get($key)))

                return false;
        }

        return true;
    }
671618
public static boolean isEqualOrNull( Object s1,
                                         Object s2 ) {
        if ( s1 == null
                && s2 == null ) {
            return true;
        } else if ( s1 != null
                && s2 != null
                && s1.equals( s2 ) ) {
            return true;
        }
        return false;
    }
1109663
private static boolean arrayEquals(Object o1, Object o2) {
        if (o1 instanceof Object[] && o2 instanceof Object[]) {
            return Arrays.equals((Object[]) o1, (Object[]) o2);
        }
        if (o1 instanceof boolean[] && o2 instanceof boolean[]) {
            return Arrays.equals((boolean[]) o1, (boolean[]) o2);
        }
        if (o1 instanceof byte[] && o2 instanceof byte[]) {
            return Arrays.equals((byte[]) o1, (byte[]) o2);
        }
        if (o1 instanceof char[] && o2 instanceof char[]) {
            return Arrays.equals((char[]) o1, (char[]) o2);
        }
        if (o1 instanceof double[] && o2 instanceof double[]) {
            return Arrays.equals((double[]) o1, (double[]) o2);
        }
        if (o1 instanceof float[] && o2 instanceof float[]) {
            return Arrays.equals((float[]) o1, (float[]) o2);
        }
        if (o1 instanceof int[] && o2 instanceof int[]) {
            return Arrays.equals((int[]) o1, (int[]) o2);
        }
        if (o1 instanceof long[] && o2 instanceof long[]) {
            return Arrays.equals((long[]) o1, (long[]) o2);
        }
        if (o1 instanceof short[] && o2 instanceof short[]) {
            return Arrays.equals((short[]) o1, (short[]) o2);
        }
        return false;
    }

    /**
     * Return as hash code for the given object; typically the value of
     * {@code Object#hashCode()}}. If the object is an array,
     * this method will delegate to any of the {@code nullSafeHashCode}
     * methods for arrays in this class. If the object is {@code null},
     * this method returns 0.
     *
     * @param obj the given object
     * @return a hash code value
     */
    public static int nullSafeHashCode(Object obj) {
        if (obj == null) {
            return 0;
        }
        if (obj.getClass().isArray()) {
            if (obj instanceof Object[]) {
                return nullSafeHashCode((Object[]) obj);
            }
            if (obj instanceof boolean[]) {
                return nullSafeHashCode((boolean[]) obj);
            }
            if (obj instanceof byte[]) {
                return nullSafeHashCode((byte[]) obj);
            }
            if (obj instanceof char[]) {
                return nullSafeHashCode((char[]) obj);
            }
            if (obj instanceof double[]) {
                return nullSafeHashCode((double[]) obj);
            }
            if (obj instanceof float[]) {
                return nullSafeHashCode((float[]) obj);
            }
            if (obj instanceof int[]) {
                return nullSafeHashCode((int[]) obj);
            }
            if (obj instanceof long[]) {
                return nullSafeHashCode((long[]) obj);
            }
            if (obj instanceof short[]) {
                return nullSafeHashCode((short[]) obj);
            }
        }
        return obj.hashCode();
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(Object[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (Object element : array) {
            hash = MULTIPLIER * hash + nullSafeHashCode(element);
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(boolean[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (boolean element : array) {
            hash = MULTIPLIER * hash + Boolean.hashCode(element);
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(byte[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (byte element : array) {
            hash = MULTIPLIER * hash + element;
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(char[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (char element : array) {
            hash = MULTIPLIER * hash + element;
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(double[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (double element : array) {
            hash = MULTIPLIER * hash + Double.hashCode(element);
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(float[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (float element : array) {
            hash = MULTIPLIER * hash + Float.hashCode(element);
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(int[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (int element : array) {
            hash = MULTIPLIER * hash + element;
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(long[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (long element : array) {
            hash = MULTIPLIER * hash + Long.hashCode(element);
        }
        return hash;
    }

    /**
     * Return a hash code based on the contents of the specified array.
     * If {@code array} is {@code null}, this method returns 0.
     *
     * @param array the specified array
     * @return a hash code value
     */
    public static int nullSafeHashCode(short[] array) {
        if (array == null) {
            return 0;
        }
        int hash = INITIAL_HASH;
        for (short element : array) {
            hash = MULTIPLIER * hash + element;
        }
        return hash;
    }

}
824808
public int compare(final SnomedConcept o1, final SnomedConcept o2) {
        if (o1 == o2) return 0;
        if (o1 != null) {
            if (o2 == null) return 1;
                // sort shorter mapping groups first
            else if (o1.mappingGroup.length() != o2.mappingGroup.length()) {
                return ((Integer)o1.mappingGroup.length()).compareTo(o2.mappingGroup.length());
            }
            else return o1.mappingGroup.compareTo(o2.mappingGroup);
        }
        return -1;
    }