public static ClassFilter[] readFilters(List children) throws InvalidDataException {
   if (children == null || children.size() == 0) {
     return ClassFilter.EMPTY_ARRAY;
   }
   List<ClassFilter> classFiltersList = new ArrayList<ClassFilter>(children.size());
   for (Iterator i = children.iterator(); i.hasNext(); ) {
     final ClassFilter classFilter = new ClassFilter();
     classFilter.readExternal((Element) i.next());
     classFiltersList.add(classFilter);
   }
   return classFiltersList.toArray(new ClassFilter[classFiltersList.size()]);
 }
Esempio n. 2
0
  private static boolean elementListsEqual(List<Element> l1, List<Element> l2) {
    if (l1 == null) return l2 == null;
    if (l2 == null) return false;

    if (l1.size() != l2.size()) return false;

    Iterator<Element> i1 = l1.iterator();

    for (Element aL2 : l2) {
      Element elem1 = i1.next();

      if (!elementsEqual(elem1, aL2)) return false;
    }
    return true;
  }
  private static boolean elementListsEqual(List<Element> l1, List<Element> l2) {
    if (l1 == null) return l2 == null;
    if (l2 == null) return false;

    if (l1.size() != l2.size()) return false;

    Iterator<Element> i1 = l1.iterator();
    Iterator<Element> i2 = l2.iterator();

    while (i2.hasNext()) {
      Element elem1 = i1.next();
      Element elem2 = i2.next();

      if (!elementsEqual(elem1, elem2)) return false;
    }
    return true;
  }
Esempio n. 4
0
  private static boolean attributeListsEqual(List<Attribute> l1, List<Attribute> l2) {
    if (l1 == null) return l2 == null;
    if (l2 == null) return false;

    if (l1.size() != l2.size()) return false;

    Iterator<Attribute> i1 = l1.iterator();

    for (Attribute aL2 : l2) {
      Attribute attr1 = i1.next();

      if (!Comparing.equal(attr1.getName(), aL2.getName())
          || !Comparing.equal(attr1.getValue(), aL2.getValue())) {
        return false;
      }
    }
    return true;
  }
  public static ReferenceType getSuperClass(
      final String baseQualifiedName, ReferenceType checkedType) {
    if (baseQualifiedName.equals(checkedType.name())) {
      return checkedType;
    }

    if (checkedType instanceof ClassType) {
      ClassType classType = (ClassType) checkedType;
      ClassType superClassType = classType.superclass();
      if (superClassType != null) {
        ReferenceType superClass = getSuperClass(baseQualifiedName, superClassType);
        if (superClass != null) {
          return superClass;
        }
      }
      List<InterfaceType> ifaces = classType.allInterfaces();
      for (Iterator<InterfaceType> it = ifaces.iterator(); it.hasNext(); ) {
        InterfaceType iface = it.next();
        ReferenceType superClass = getSuperClass(baseQualifiedName, iface);
        if (superClass != null) {
          return superClass;
        }
      }
    }

    if (checkedType instanceof InterfaceType) {
      List<InterfaceType> list = ((InterfaceType) checkedType).superinterfaces();
      for (Iterator<InterfaceType> it = list.iterator(); it.hasNext(); ) {
        InterfaceType superInterface = it.next();
        ReferenceType superClass = getSuperClass(baseQualifiedName, superInterface);
        if (superClass != null) {
          return superClass;
        }
      }
    }
    return null;
  }