예제 #1
0
 // sort branch heads by number of touched commit, to minimize the length of the recursive calls
 boolean buildMetaGraph() {
   Entry<Commit, ArrayList<Commit>> e;
   Iterator<Entry<Commit, ArrayList<Commit>>> setIt = comInB.entrySet().iterator();
   int sorted[], size = comInB.keySet().size();
   Integer cNum[] = new Integer[size];
   Commit[] commits = new Commit[size];
   ArrayList<Commit> sortedCommits = new ArrayList<Commit>(size);
   for (int i = 0; i < size; i++) {
     e = setIt.next();
     commits[i] = e.getKey();
     cNum[i] = e.getValue().size();
   }
   sorted = IndexedSortable.sortedPermutation(cNum, false);
   for (int i = 0; i < size; i++) {
     sortedCommits.add(commits[sorted[i]]);
   }
   metaGraph = MetaGraph.createMetaGraph(allCommits, sortedCommits);
   return metaGraph.checkup();
 }
예제 #2
0
  @SuppressWarnings("unchecked")
  @Override
  public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    int i, j, size;
    BranchRef b;
    name = in.readUTF();
    id = in.readLong();
    size = in.readInt();
    allBranches = new ArrayList<BranchRef>(size);
    for (i = 0; i < size; i++) {
      b = new BranchRef();
      b.readExternal(in);
      b.index = i;
      allBranches.add(b);
    }
    Commit c;
    size = in.readInt();
    allCommits = new ArrayList<Commit>(size);
    for (i = 0; i < size; i++) {
      c = new Commit();
      c.readExternal(in);
      for (j = 0; j < c.branches.size(); j++) {
        c.branches.set(j, getBranchRef(c.branches.get(j).index));
      }
      if (c.isHead()) {
        for (j = 0; j < c.heads.size(); j++) {
          c.heads.set(j, getBranchRef(c.heads.get(j).index));
        }
      }
      allCommits.add(c);
    }
    Person p;
    size = in.readInt();
    allAuthors = new ArrayList<Person>(size);
    for (i = 0; i < size; i++) {
      p = new Person();
      p.readExternal(in);
      allAuthors.add(p);
    }

    branches = importMap(in);
    comInB = importMap(in);

    comOnlyInB = importMap(in);
    comInF = importMap(in);
    comOnlyInF = importMap(in);
    comNotInF = importMap(in);
    authOfComInB = importMap(in);
    authOfComOnlyInB = importMap(in);
    authOfComInF = importMap(in);
    authOfComOnlyInF = importMap(in);
    authOfComNotInF = importMap(in);

    metaGraph = new MetaGraph(allCommits);
    metaGraph.readExternal(in);
    if (!metaGraph.checkup()) System.err.println("ERROR : Metagraph checkup failed!!!");
    //  else // XXX
    //    System.out.println(this.name + " post-dated commit ratio : " +
    // metaGraph.checkTimestamps()); //.exportToGexf(name + "_complete");

  }