Replies the top-most type which is common to both given objects.

@param instance1 first object.
@param instance2 second object.
@return the top-most type which is common to both given objects.
@since 6.0
495816
@Pure
	public static Class<?> getCommonType(Object instance1, Object instance2) {
		if (instance1 == null) {
			return instance2 == null ? null : instance2.getClass();
		}
		if (instance2 == null) {
			return instance1.getClass();
		}
		Class<?> top = instance1.getClass();
		while (!top.isInstance(instance2)) {
			top = top.getSuperclass();
			assert top != null;
		}
		return top;
	}
842214
@SuppressWarnings("checkstyle:rightCurly")
  static <T> ImmutableList<T> sortMostSpecificFirst(final Iterable<T> classes,
      final Function<T, Class<?>> toClass) {
    final List<T> working = Lists.newArrayList();
    // strip duplicates
    for (final T t : classes) {
      if (!working.contains(t)) {
        working.add(t);
      }
    }
    final List<T> sorted = Lists.newArrayList();
    final Predicate<T> mostSpecific = createMostSpecificMatchPredicate(working, toClass);
    boolean changed = false;
    do {
      changed = false;
      for (final Iterator<T> iterator = working.iterator(); iterator.hasNext();) {
        final T t = iterator.next();
        if (mostSpecific.apply(t)) {
          sorted.add(t);
          iterator.remove();
          changed = true;
        }
      }
    } while (changed);
    if (!working.isEmpty()) {
      throw new IllegalStateException(
          "Unable to find a element that does not have a more specific element in the set "
              + working);
    }
    return ImmutableList.copyOf(sorted);
  }
819437
public int getMaximumNumberOfInstances(final InstanceType instanceType) {

		final Integer val = this.maximumMap.get(instanceType);
		if (val != null) {
			return val.intValue();
		}

		return 0;
	}
148100
public String toPDB(Structure s1, Structure s2){


		Structure newpdb = getAlignedStructure(s1, s2);

		return newpdb.toPDB();
	}
1370067
public Type toPrimitive() {
        if (mPrimitive) {
            return this;
        }
        else {
            Class<?> primitive = convertToPrimitive(mObjectClass);
            if (primitive.isPrimitive()) { return new Type(primitive); }
            else { return new Type(mGenericType, primitive); }
        }
    }
963091
public static boolean isSameType(@Nonnull TypeMirror t1, @Nonnull TypeMirror t2) {
        String t1Name = toUniqueString(t1);
        String t2Name = toUniqueString(t2);

        return t1Name.equals(t2Name);
    }
822921
public com.google.appengine.v1.InstanceOrBuilder getInstancesOrBuilder(
      int index) {
    return instances_.get(index);
  }
743919
public com.google.appengine.v1.Instance getInstances(int index) {
    return instances_.get(index);
  }
434064
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator, BinaryOperator<S> equalityPolicy) {
    S result;
    int flag = comparator.compare(solution1, solution2);
    if (flag == -1) {
      result = solution1;
    } else if (flag == 1) {
      result = solution2;
    } else {
      result = equalityPolicy.apply(solution1, solution2);
    }

    return result;
  }
1177203
public void setInstancesToProtect(java.util.Collection<String> instancesToProtect) {
        if (instancesToProtect == null) {
            this.instancesToProtect = null;
            return;
        }

        this.instancesToProtect = new com.amazonaws.internal.SdkInternalList<String>(instancesToProtect);
    }
8059
private int compare(Object k1, Object k2) {
        return (mComparator==null ? ((Comparable)k1).compareTo(k2)
                : mComparator.compare(k1, k2));
    }
621112
public int compare(Object o1, Object o2) {
		List list1 = (List) o1;
		List list2 = (List) o2;

		for (int i = 0; i < list1.size(); i++) {
			if (list2.size() > i) {
				Comparable component1 = (Comparable) list1.get(i);
				Comparable component2 = (Comparable) list2.get(i);
				int componentsCompared = component1.compareTo(component2);
				if (componentsCompared != 0) {
					return componentsCompared;
				}
			}
			else {
				// First instance has more components, so that instance is
				// greater.
				return 1;
			}
		}

		// All components so far are equal - if the other instance has
		// more components it is greater otherwise they are equal.
		if (list2.size() > list1.size()) {
			return -1;
		}
		else {
			return 0;
		}
	}
713013
public int getMinimumNumberOfInstances(final InstanceType instanceType) {

		final Integer val = this.minimumMap.get(instanceType);
		if (val != null) {
			return val.intValue();
		}

		return 0;
	}
440348
public static <T1, T2> TypeFactory<Tuple2<T1, T2>> typeFactory( TypeFactory<T1> type1,
                                                                    TypeFactory<T2> type2 ) {
        return new Tuple2TypeFactory<>(type1, type2);
    }
214546
public final ObjectType getTopMostDefiningType(String propertyName) {
    checkState(isConstructor() || isInterface());
    checkArgument(getInstanceType().hasProperty(propertyName));
    FunctionType ctor = this;

    if (isInterface()) {
      return getInstanceType().getTopDefiningInterface(propertyName);
    }

    ObjectType topInstanceType = null;
    do {
      topInstanceType = ctor.getInstanceType();
      ctor = ctor.getSuperClassConstructor();
    } while (ctor != null && ctor.getPrototype().hasProperty(propertyName));

    return topInstanceType;
  }
743394
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> Comparator<Pair<T1, T2>> naturalOrder() {
        return new Comparator<Pair<T1,T2>>() {

            @Override
            public int compare(Pair<T1, T2> lhs, Pair<T1, T2> rhs) {
                return compareTo(lhs, rhs);
            }

        };
	}
1156608
public double distance(Instance first, Instance second) {
    return distance(first, second, Double.POSITIVE_INFINITY);
  }