예제 #1
0
  /* (non-Javadoc)
   * @see org.sosy_lab.ccvisu.readers.filter.Filter#apply(org.sosy_lab.ccvisu.graph.Relation)
   */
  @Override
  public Relation apply(Relation relation) {
    assert (relation != null);
    Relation newRel = new Relation();

    for (Tuple tuple : relation) {
      if (nameIsWhitelisted(tuple.getRelationName())) {
        newRel.addTuple(tuple);
      }
    }

    return newRel;
  }
예제 #2
0
파일: Sort.java 프로젝트: michael-k/ccvisu
  @Override
  public Relation apply(Relation relation) {
    assert (relation != null);

    Relation sortedRelation = new Relation(relation);
    Relation.sort(sortedRelation, new CompareTuples());
    return sortedRelation;
  }
예제 #3
0
  /**
   * Reads the edges of a graph in CVS log format from stream reader <code>in</code>, and stores
   * them in a list (of <code>GraphEdgeString</code> elements).
   *
   * @return List of string edges.
   */
  @Override
  public Relation readTuples() {
    Relation resultingRelation = new Relation();

    List<Revision> revisionList = readRevisionList();
    SortedMap<Long, Collection<SortedSet<Revision>>> transMap = recoverTransactions(revisionList);

    Set<Long> timeSet = transMap.keySet();
    for (Long time : timeSet) {
      Collection<SortedSet<Revision>> transColl = transMap.get(time);
      for (SortedSet<Revision> revSet : transColl) {
        for (Revision revision : revSet) {

          List<String> tuples = new ArrayList<String>();
          tuples.add(Integer.toString(revision.transaction));
          tuples.add(revision.filename);
          Tuple tuple = new Tuple(revision.relName, tuples);
          resultingRelation.addTuple(tuple);

          // Print revision entry with timestamp and user of the changes to stdout.
          if (verbosity.isAtLeast(Verbosity.VERBOSE)) {
            Calendar cal = Calendar.getInstance();
            cal.setTimeInMillis(revision.time.longValue());
            System.out.println(
                "REV  \t"
                    + Integer.toString(revision.transaction)
                    + "\t"
                    + "\""
                    + cal.getTime()
                    + "\""
                    + "\t"
                    + revision.user
                    + "\t"
                    + revision.filename
                    + "\t"
                    + revision.relName);
          }
        }
      }
    }
    return resultingRelation;
  }