public Element toXml() {
   Element root = new Element(ROOT_ELEMENT);
   root.setAttribute(ATTR_VERSION, Integer.toString(DEPENDENCIES_VERSION));
   if (myModelHash != null) {
     root.setAttribute(ATTR_MODEL_HASH, myModelHash);
   }
   if (myParametersHash != null) {
     root.setAttribute(ATTR_PARAMS_HASH, myParametersHash);
   }
   String[] models = myUsedModelsHashes.keySet().toArray(new String[myUsedModelsHashes.size()]);
   Arrays.sort(models);
   for (String model : models) {
     Element e = new Element(NODE_MODEL);
     e.setAttribute(ATTR_MODEL_ID, model);
     String hash = myUsedModelsHashes.get(model);
     if (hash != null) {
       e.setAttribute(ATTR_HASH, hash);
     }
     root.addContent(e);
   }
   if (myRootDependencies != null) {
     for (GenerationRootDependencies data : myRootDependencies) {
       Element e = new Element(data.getRootId() != null ? NODE_ROOT : NODE_COMMON);
       data.saveTo(e);
       root.addContent(e);
     }
   }
   return root;
 }
 private GenerationDependencies(
     List<GenerationRootDependencies> data,
     String modelHash,
     String parametersHash,
     Map<String, String> externalHashes,
     List<GenerationRootDependencies> unchanged,
     int skippedCount,
     int fromCacheCount) {
   this.containsIncrementalInfo = true;
   this.myRootDependencies = data;
   this.mySkippedCount = skippedCount;
   this.myFromCacheCount = fromCacheCount;
   this.myRootDependenciesMap = new HashMap<String, GenerationRootDependencies>(data.size());
   this.myModelHash = modelHash;
   this.myParametersHash = parametersHash;
   this.myUnchanged = unchanged;
   this.myUsedModelsHashes = externalHashes;
   for (GenerationRootDependencies rd : data) {
     String id = rd.getRootId();
     myRootDependenciesMap.put(id == null ? ModelDigestHelper.HEADER : id, rd);
   }
 }