Checks if two classes belong to the same package.

@param c1
one of the classes to test.
@param c2
the other class to test.
@return {@code true} if the two classes belong to the same package,
{@code false} otherwise.
181493
private boolean inSamePackage(Class<?> c1, Class<?> c2) {
        String nameC1 = c1.getName();
        String nameC2 = c2.getName();
        int indexDotC1 = nameC1.lastIndexOf('.');
        int indexDotC2 = nameC2.lastIndexOf('.');
        if (indexDotC1 != indexDotC2) {
            return false; // cannot be in the same package if indices are not the same
        }
        if (indexDotC1 == -1) {
            return true; // both of them are in default package
        }
        return nameC1.regionMatches(0, nameC2, 0, indexDotC1);
    }
1278253
public static boolean sameClass(Class c, Object o) {
        if (o==null) return false;
        return o.getClass() == c;
    }
480881
public final boolean contains(char c1, char c2) {
    try {
      String s = new String(new String(new char[]{c1, c2}).getBytes(enc), enc);
      return s.length() == 2 && s.charAt(0) == c1 && s.charAt(1) == c2;
    }
    catch (UnsupportedEncodingException e) {
      return false;
    }
    // work around gcj bug (libgcj/9802)
    catch (RuntimeException e) {
      return false;
    }
  }
838516
public boolean checkInstanceOf(Context context, CharSequence targetClassName,
            CharSequence loaderPackage, CharSequence referenceClassName) {
        if ((targetClassName == null) || (referenceClassName == null)) {
            return false;
        }

        // Try a shortcut for efficiency.
        if (TextUtils.equals(targetClassName, referenceClassName)) {
            return true;
        }

        final Class<?> referenceClass = loadOrGetCachedClass(
                context, referenceClassName, loaderPackage);
        if (referenceClass == null) {
            return false;
        }

        return checkInstanceOf(context, targetClassName, loaderPackage, referenceClass);
    }
1084035
protected boolean isImportTargetPackage(ClassDesc classDesc, String importPackageName) {
    if (importPackageName == null) {
      return false;
    }
    if (importPackageName.isEmpty()) {
      return false;
    }
    if (importPackageName.equals(classDesc.getPackageName())) {
      return false;
    }
    if (importPackageName.equals("java.lang")) {
      return false;
    }
    return true;
  }
276684
@Override
    public boolean areEndPointsEqual(Object ep1, Object ep2)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "areEndPointsEqual", new Object[] { ep1, ep2 });

        boolean isEqual = false;

        if (ep1 instanceof CFEndPoint && ep2 instanceof CFEndPoint)
        {
            CFEndPoint cfEp1 = (CFEndPoint) ep1;
            CFEndPoint cfEp2 = (CFEndPoint) ep2;

            // The CFW does not provide an equals method for its endpoints.
            // We need to manually equals the important bits up
            isEqual = isEqual(cfEp1.getAddress(), cfEp2.getAddress()) &&
                      isEqual(cfEp1.getName(), cfEp2.getName()) &&
                      cfEp1.getPort() == cfEp2.getPort() &&
                      cfEp1.isLocal() == cfEp2.isLocal() &&
                      cfEp1.isSSLEnabled() == cfEp2.isSSLEnabled();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "areEndPointsEqual", Boolean.valueOf(isEqual));
        return isEqual;
    }
506627
public boolean hasConversion(String type) {
		if ((isImplicitSarlTypes() && type.startsWith(IMPLICIT_PACKAGE))
			|| isImplicitJvmTypes()) {
			return true;
		}
		if (this.mapping == null) {
			this.mapping = initMapping();
		}
		return this.mapping.containsKey(type);
	}
959957
public static OpPredicate classEquals(final Class<?> c){
        return new OpPredicate() {
            @Override
            public boolean matches(SameDiff sameDiff, DifferentialFunction function) {
                return function.getClass() == c;
            }
        };
    }
982293
public boolean isImplicitTeaImport(Class<?> clazz) {
        if (getArrayType(clazz).isPrimitive()) {
            return true;
        }

        return isImplicitTeaImport(getClassPackage(clazz));
    }
874441
public static int compare (Comparable<?> c1, Comparable<?> c2)
    {
        @SuppressWarnings("unchecked") Comparable<Object> cc1 = (Comparable<Object>)c1;
        @SuppressWarnings("unchecked") Comparable<Object> cc2 = (Comparable<Object>)c2;
        return cc1.compareTo(cc2);
    }
795223
private static boolean areEqualWithGenerics(ClassNode a, ClassNode b) {
        if (a==null) return b==null;
        if (!a.equals(b)) return false;
        if (a.isUsingGenerics() && !b.isUsingGenerics()) return false;
        GenericsType[] gta = a.getGenericsTypes();
        GenericsType[] gtb = b.getGenericsTypes();
        if (gta==null && gtb!=null) return false;
        if (gtb==null && gta!=null) return false;
        if (gta!=null && gtb!=null) {
            if (gta.length!=gtb.length) return false;
            for (int i = 0; i < gta.length; i++) {
                GenericsType ga = gta[i];
                GenericsType gb = gtb[i];
                boolean result = ga.isPlaceholder()==gb.isPlaceholder() && ga.isWildcard()==gb.isWildcard();
                result = result && ga.isResolved() && gb.isResolved();
                result = result && ga.getName().equals(gb.getName());
                result = result && areEqualWithGenerics(ga.getType(), gb.getType());
                result = result && areEqualWithGenerics(ga.getLowerBound(), gb.getLowerBound());
                if (result) {
                    ClassNode[] upA = ga.getUpperBounds();
                    if (upA!=null) {
                        ClassNode[] upB = gb.getUpperBounds();
                        if (upB==null || upB.length!=upA.length) return false;
                        for (int j = 0; j < upA.length; j++) {
                            if (!areEqualWithGenerics(upA[j],upB[j])) return false;
                        }
                    }
                }
                if (!result) return false;
            }
        }
        return true;
    }
99153
public boolean isSuperClassOf(final OClass iClass) {
    OClass cls = iClass;
    while (cls != null) {
      if (cls.getName().equals(name))
        return true;
      cls = cls.getSuperClass();
    }
    return false;
  }
1263844
public static boolean isAncestor(final WComponent component1, final WComponent component2) {
		for (WComponent parent = component2.getParent(); parent != null; parent = parent.getParent()) {
			if (parent == component1) {
				return true;
			}
		}

		return false;
	}
288549
protected boolean checkExcludePackages(String classPackageName) {
		if (excludePackages != null && excludePackages.length > 0) {
			WildcardHelper wildcardHelper = new WildcardHelper();

			// we really don't care about the results, just the boolean
			Map<String, String> matchMap = new HashMap<String, String>();

			for (String packageExclude : excludePackages) {
				int[] packagePattern = wildcardHelper.compilePattern(packageExclude);
				if (wildcardHelper.match(matchMap, classPackageName, packagePattern)) {
					return false;
				}
			}
		}
		return true;
	}
1195196
protected boolean oneOfClasses(final Class f, final Class[] classes) {
        for (final Class c : classes) {
            if (c.equals(f)) {
                return true;
            }
        }
        return false;
    }
322553
public static boolean sameMembers(View v1, View v2) {
        if(v1 == v2)
            return true;
        if(v1.size() != v2.size())
            return false;
        Address[][] diff=diff(v1, v2);
        return diff[0].length == 0 && diff[1].length == 0;
    }
856109
public static boolean isValidClassName(String s) {
        if (s.length() < 1) return false;
        if (s.equals("package-info")) return true;
        if (surrogatesSupported) {
            int cp = s.codePointAt(0);
            if (!Character.isJavaIdentifierStart(cp))
                return false;
            for (int j = Character.charCount(cp); j < s.length(); j += Character.charCount(cp)) {
                cp = s.codePointAt(j);
                if (!Character.isJavaIdentifierPart(cp))
                    return false;
            }
        } else {
            if (!Character.isJavaIdentifierStart(s.charAt(0)))
                return false;
            for (int j = 1; j < s.length(); j++)
                if (!Character.isJavaIdentifierPart(s.charAt(j)))
                    return false;
        }
        return true;
    }