public ResourceDownloaderAlternateImpl(
      ResourceDownloaderBaseImpl _parent,
      ResourceDownloader[] _delegates,
      int _max_to_try,
      boolean _random) {
    super(_parent);

    delegates = _delegates;
    max_to_try = _max_to_try;
    random = _random;

    for (int i = 0; i < delegates.length; i++) {

      ((ResourceDownloaderBaseImpl) delegates[i]).setParent(this);
    }

    if (max_to_try < 0) {

      max_to_try = delegates.length;

    } else {

      max_to_try = Math.min(max_to_try, delegates.length);
    }

    if (random) {

      List l = new ArrayList(Arrays.asList(delegates));

      delegates = new ResourceDownloader[delegates.length];

      for (int i = 0; i < delegates.length; i++) {

        delegates[i] = (ResourceDownloader) l.remove((int) (Math.random() * l.size()));
      }
    }
  }
 public void removeListener(ResourceDownloaderListener l) {
   listeners.remove(l);
 }
 protected void removeChild(ResourceDownloaderBaseImpl kid) {
   children.remove(kid);
 }