Exemple #1
0
 /**
  * Sort the contained elements.
  *
  * @return a Collection of Resources.
  */
 protected synchronized Collection<Resource> getCollection() {
   ResourceCollection rc = getResourceCollection();
   Iterator<Resource> iter = rc.iterator();
   if (!(iter.hasNext())) {
     return Collections.emptySet();
   }
   List<Resource> result = (List<Resource>) CollectionUtils.asCollection(iter);
   Collections.sort(result, comp);
   return result;
 }
 protected Enumeration<URL> findResources(final String name, final boolean parentHasBeenSearched)
     throws IOException {
   final Enumeration<URL> mine = new ResourceEnumeration(name);
   Enumeration<URL> base;
   if (this.parent != null && (!parentHasBeenSearched || this.parent != this.getParent())) {
     base = this.parent.getResources(name);
   } else {
     base = new CollectionUtils.EmptyEnumeration<URL>();
   }
   if (this.isParentFirst(name)) {
     return CollectionUtils.append(base, mine);
   }
   if (this.ignoreBase) {
     return (this.getRootLoader() == null)
         ? mine
         : CollectionUtils.append(mine, this.getRootLoader().getResources(name));
   }
   return CollectionUtils.append(mine, base);
 }
Exemple #3
0
    /** @see java.lang.Object#equals */
    public boolean equals(Object rhs) {
      if (rhs == null || rhs.getClass() != getClass()) {
        return false;
      }

      if (rhs == this) {
        return true;
      }

      Section rhsSection = (Section) rhs;

      return CollectionUtils.equals(attributes, rhsSection.attributes);
    }
Exemple #4
0
    /** @see java.lang.Object#equals */
    public boolean equals(Object rhs) {
      if (rhs == null || rhs.getClass() != getClass()) {
        return false;
      }

      if (rhs == this) {
        return true;
      }

      Attribute rhsAttribute = (Attribute) rhs;
      String lhsKey = getKey();
      String rhsKey = rhsAttribute.getKey();
      if ((lhsKey == null && rhsKey != null)
          || (lhsKey != null && rhsKey == null)
          || !lhsKey.equals(rhsKey)) {
        return false;
      }

      return CollectionUtils.equals(values, rhsAttribute.values);
    }
Exemple #5
0
  /** @see java.lang.Object#equals */
  public boolean equals(Object rhs) {
    if (rhs == null || rhs.getClass() != getClass()) {
      return false;
    }

    if (rhs == this) {
      return true;
    }

    Manifest rhsManifest = (Manifest) rhs;
    if (manifestVersion == null) {
      if (rhsManifest.manifestVersion != null) {
        return false;
      }
    } else if (!manifestVersion.equals(rhsManifest.manifestVersion)) {
      return false;
    }

    if (!mainSection.equals(rhsManifest.mainSection)) {
      return false;
    }

    return CollectionUtils.equals(sections, rhsManifest.sections);
  }