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 org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] convertBundleInfos(
     BundleInfo[] configuration, URI installArea) {
   // convert to SimpleConfigurator BundleInfo Type
   org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[] simpleInfos =
       new org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo[configuration.length];
   for (int i = 0; i < configuration.length; i++) {
     BundleInfo bundleInfo = configuration[i];
     URI location = bundleInfo.getLocation();
     if (bundleInfo.getSymbolicName() == null
         || bundleInfo.getVersion() == null
         || location == null)
       throw new IllegalArgumentException(
           "Cannot persist bundleinfo: " + bundleInfo.toString()); // $NON-NLS-1$
     // only need to make a new BundleInfo if we are changing it.
     if (installArea != null) location = URIUtil.makeRelative(location, installArea);
     simpleInfos[i] =
         new org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo(
             bundleInfo.getSymbolicName(),
             bundleInfo.getVersion(),
             location,
             bundleInfo.getStartLevel(),
             bundleInfo.isMarkedAsStarted());
     simpleInfos[i].setBaseLocation(bundleInfo.getBaseLocation());
   }
   return simpleInfos;
 }
 /*
  * Return a boolean value indicating whether or not a bundle with the given id
  * is listed in the bundles.info file. If the version is non-null, check to ensure the
  * version is the expected one. If the location is non-null then do a String#contains check.
  */
 public boolean isInBundlesInfo(File bundlesInfo, String bundleId, String version, String location)
     throws IOException {
   BundleInfo[] infos = loadBundlesInfo(bundlesInfo);
   for (int i = 0; infos != null && i < infos.length; i++) {
     BundleInfo info = infos[i];
     if (!bundleId.equals(info.getSymbolicName())) continue;
     if (version != null && !version.equals(info.getVersion())) continue;
     if (location == null) return true;
     return info.getLocation().toString().contains(location);
   }
   return false;
 }
 void setSystemBundles(BundlesState state, LocationInfo info) {
   BundleInfo systemBundleInfo = state.getSystemBundle();
   if (systemBundleInfo == null) {
     // TODO Log
     // throw new IllegalStateException("There is no systemBundle.\n");
     return;
   }
   if (state.isFullySupported())
     if (!this.checkResolve(systemBundleInfo, state)) {
       printoutUnsatisfiedConstraints(systemBundleInfo, state);
       return;
     }
   info.systemBundleLocation = systemBundleInfo.getLocation();
   BundleInfo[] fragments = state.getSystemFragmentedBundles();
   info.systemFragmentedBundleLocations = new URI[fragments.length];
   for (int i = 0; i < fragments.length; i++)
     info.systemFragmentedBundleLocations[i] = fragments[i].getLocation();
 }