private void algorithm(
      int initialSl,
      SortedMap bslToList,
      BundleInfo configuratorBInfo,
      List setToInitialConfig,
      List setToSimpleConfig,
      LocationInfo info) {
    int configuratorSL = configuratorBInfo.getStartLevel();

    Integer sL0 = (Integer) bslToList.keySet().iterator().next(); // StartLevel == 0;
    List list0 = (List) bslToList.get(sL0);
    if (sL0.intValue() == 0)
      for (Iterator ite2 = list0.iterator(); ite2.hasNext(); ) {
        BundleInfo bInfo = (BundleInfo) ite2.next();
        if (isSystemBundle(bInfo.getLocation(), info)) {
          setToSimpleConfig.add(bInfo);
          break;
        }
      }

    for (Iterator ite = bslToList.keySet().iterator(); ite.hasNext(); ) {
      Integer sL = (Integer) ite.next();
      List list = (List) bslToList.get(sL);

      if (sL.intValue() < configuratorSL) {
        for (Iterator ite2 = list.iterator(); ite2.hasNext(); ) {
          BundleInfo bInfo = (BundleInfo) ite2.next();
          if (!isSystemBundle(bInfo.getLocation(), info)) setToInitialConfig.add(bInfo);
        }
      } else if (sL.intValue() > configuratorSL) {
        for (Iterator ite2 = list.iterator(); ite2.hasNext(); ) {
          BundleInfo bInfo = (BundleInfo) ite2.next();
          if (isPrerequisiteBundles(bInfo.getLocation(), info)
              || isSystemFragmentBundle(bInfo.getLocation(), info))
            if (!isSystemBundle(bInfo.getLocation(), info)) setToInitialConfig.add(bInfo);
          setToSimpleConfig.add(bInfo);
        }
      } else {
        boolean found = false;
        for (Iterator ite2 = list.iterator(); ite2.hasNext(); ) {
          BundleInfo bInfo = (BundleInfo) ite2.next();
          if (found) {
            if (!isSystemBundle(bInfo.getLocation(), info))
              if (isPrerequisiteBundles(bInfo.getLocation(), info)
                  || isSystemFragmentBundle(bInfo.getLocation(), info))
                setToInitialConfig.add(bInfo);
            setToSimpleConfig.add(bInfo);
            continue;
          }
          if (isTargetConfiguratorBundle(bInfo.getLocation())) found = true;
          else if (!isSystemBundle(bInfo.getLocation(), info)) setToInitialConfig.add(bInfo);
          setToSimpleConfig.add(bInfo);
        }
      }
    }

    setToInitialConfig.add(configuratorBInfo);
  }
 private SortedMap getSortedMap(int initialSl, BundleInfo[] bInfos) {
   SortedMap bslToList = new TreeMap();
   for (int i = 0; i < bInfos.length; i++) {
     Integer sL = new Integer(bInfos[i].getStartLevel());
     if (sL.intValue() == BundleInfo.NO_LEVEL) sL = new Integer(initialSl);
     List list = (List) bslToList.get(sL);
     if (list == null) {
       list = new LinkedList();
       bslToList.put(sL, list);
     }
     list.add(bInfos[i]);
   }
   return bslToList;
 }