anchor.diff:  part of distributed_dart;
   
  -/// Represents a file in the tree which can have dependencies. (e.g. Dart file)
  +/**
  + * The purpose of this class is to represent a Dart program and its 
  + * dependencies and make it possible to send and receive the object as JSON. 
  + * All dependencies are represented as a set of unique [FileNode] objects.
  + */
   class DartProgram extends DependencyNode {
     static const String _NAME = "name";
     static const String _PATH = "path";
     static const String _HASH = "hash";
     static const String _DEPENDENCIES = "dependencies";
  -  
  +
  +  DartProgram._internal(String name, Path path, List<int> hash, 
  +      List<FileNode> dependencies) : super(name,path,hash,dependencies);
  +  
  +  /**
  +   * Create [DartProgram] instance from [FileNode] or [DependencyNode] instance.
  +   * 
  +   * All dependencies are converted to [FileNode] instances and all paths are 
  +   * relative to the [DartProgram]. Because the paths are changed, the 
  +   * [DartProgram] instance will contain copies of [FileNode] instances and not 
  +   * the actual [FileNode] instances.
  +   */
  +  factory DartProgram(FileNode program) {
  +    List<FileNode> dependencies = program.getFileNodes().map((FileNode node) {
  +      return node.copy;
  +    }).toList(growable: false);
  +    
  +    // Also remove the needed segments from the file this object represent.
  +    int segmentsToRemove = _shortenPaths(dependencies);
  +    Path newPath = _removeSegmentsOfPath(program._path, segmentsToRemove);
  +    
  +    return new DartProgram._internal(program._name, newPath, program._fileHash,
  +                                     dependencies);
  +  }
  +  
  +  /// Create [DartProgram] instance from [String] containing a JSON object 
  +  /// (created from [toJson]).
     factory DartProgram.fromJson(String jsonString) {
       return new DartProgram.fromMap(json.parse(jsonString));
     }
     
  +  /// Create [DartProgram] from [Map] created by parsing a JSON object.
     factory DartProgram.fromMap(Map jsonMap) {
       List<FileNode> dependencies = new List<FileNode>();
       
  
positive.code:                                      jsonMap[_HASH], dependencies);
    }
    
    factory DartProgram(FileNode program) {
      List<FileNode> dependencies = program.getFileNodes().map((FileNode node) {
        return node.copy;
      }).toList(growable: false);
      
      int segmentsToRemove = _shortenPaths(dependencies);
      Path newPath = _removeSegmentsOfPath(program._path, segmentsToRemove);
      
      return new DartProgram._internal(program._name,
                                       newPath,
                                       program._fileHash,
                                       dependencies);
    }
    
    DartProgram._internal(String name,
                          Path path,
                          List<int> hash,
                          List<FileNode> dependencies) 
    : super(name,path,hash,dependencies);
    
    /*
     *  Because the operation can be a little CPU intensive we save this. There
     *  are no risks involved because the hashsum of each dependency of the 
  
negative.code:     return _treeHashCache;
    }
    
    Map<String, Object> toJson() {
      _log("Running toJson() for $name");
      
  