public ModuleResolveState getModule(ModuleIdentifier id) {
   ModuleResolveState module = modules.get(id);
   if (module == null) {
     module = new ModuleResolveState(id, this, metaDataResolver);
     modules.put(id, module);
   }
   return module;
 }
    public ModuleVersionResolveState getVersion(ModuleVersionIdentifier id) {
      ModuleVersionResolveState moduleRevision = versions.get(id);
      if (moduleRevision == null) {
        moduleRevision = new ModuleVersionResolveState(this, id, metaDataResolver);
        versions.put(id, moduleRevision);
      }

      return moduleRevision;
    }
 public ModuleVersionSelectorResolveState getSelector(DependencyMetaData dependencyMetaData) {
   ModuleVersionSelector requested = dependencyMetaData.getRequested();
   ModuleVersionSelectorResolveState resolveState = selectors.get(requested);
   if (resolveState == null) {
     resolveState = new ModuleVersionSelectorResolveState(dependencyMetaData, idResolver, this);
     selectors.put(requested, resolveState);
   }
   return resolveState;
 }
 public ConfigurationNode getConfigurationNode(
     ModuleVersionResolveState module, String configurationName) {
   ResolvedConfigurationIdentifier id =
       new ResolvedConfigurationIdentifier(module.id, configurationName);
   ConfigurationNode configuration = nodes.get(id);
   if (configuration == null) {
     configuration = new ConfigurationNode(id, module, this);
     nodes.put(id, configuration);
   }
   return configuration;
 }
 public ModuleVersionResolveState clearSelection() {
   ModuleVersionResolveState previousSelection = selected;
   selected = null;
   for (ModuleVersionResolveState version : versions.values()) {
     version.state = ModuleState.Conflict;
   }
   return previousSelection;
 }
 public void select(ModuleVersionResolveState selected) {
   assert this.selected == null;
   this.selected = selected;
   for (ModuleVersionResolveState version : versions.values()) {
     version.state = ModuleState.Evicted;
   }
   selected.state = ModuleState.Selected;
 }
 public void restart(ModuleVersionResolveState selected) {
   select(selected);
   for (ModuleVersionResolveState version : versions.values()) {
     version.restart(selected);
   }
   for (ModuleVersionSelectorResolveState selector : selectors) {
     selector.restart(selected);
   }
   for (DependencyEdge dependency : new ArrayList<DependencyEdge>(unattachedDependencies)) {
     dependency.restart(selected);
   }
   unattachedDependencies.clear();
 }
 public ResolveState(
     ComponentResolveResult rootResult,
     String rootConfigurationName,
     DependencyToComponentIdResolver idResolver,
     ComponentMetaDataResolver metaDataResolver,
     DependencyToConfigurationResolver dependencyToConfigurationResolver) {
   this.idResolver = idResolver;
   this.metaDataResolver = metaDataResolver;
   this.dependencyToConfigurationResolver = dependencyToConfigurationResolver;
   ModuleVersionResolveState rootVersion = getRevision(rootResult.getId());
   rootVersion.setMetaData(rootResult.getMetaData());
   root =
       new RootConfigurationNode(
           rootVersion,
           new ResolvedConfigurationIdentifier(rootVersion.id, rootConfigurationName),
           this);
   nodes.put(root.id, root);
   root.moduleRevision.module.select(root.moduleRevision);
 }
 public Collection<ModuleVersionResolveState> getVersions() {
   return versions.values();
 }
 public Collection<ConfigurationNode> getConfigurationNodes() {
   return nodes.values();
 }