Package net.sf.collabreview.core

Examples of net.sf.collabreview.core.Artifact


   * @param repository the Repository for reading the Artifact from
   * @param ai     identifier of the artifact to analyze
   * @return the number of non-empty lines in the Artifacts content
   */
  public static int countNonEmptyLines(Repository repository, ArtifactIdentifier ai) {
    Artifact artifact = repository.getArtifact(ai);
    String source = artifact.getContent();
    String[] lines = source.split("[\n\r]");
    int count = 0;
    for (String line : lines) {
      Matcher m = emptyLine.matcher(line);
      if (!m.matches()) {
View Full Code Here


        setResult(bestSoFar);
      }
      return;
    }
    // iterate through all children in the loop
    Artifact potentialAncestor = (Artifact) childrenIterator.next();
    if (currentSetOptimum == null) {
      currentSetOptimum = getArtifactSimilarity().findTransformScript(potentialAncestor, getNewArtifactContent(), bestSoFar.getCost() + 1);
    } else {
      ArtifactSimilarity.TransformInfo ti = getArtifactSimilarity().findTransformScript(potentialAncestor, getNewArtifactContent(), bestSoFar.getCost() + 1);
      if (ti.getCost() < currentSetOptimum.getCost()) {
View Full Code Here

      setResult(bestSoFar);
      return;
    }
    ArtifactIdentifier aid = allArtifIterator.next();
    assert aid != null;
    Artifact potentialAncestor = getRepository().getArtifact(aid);
    assert potentialAncestor != null;
    ArtifactSimilarity.TransformInfo currentTransform = getArtifactSimilarity().findTransformScript(potentialAncestor, getNewArtifactContent(), Integer.MAX_VALUE);
    if (bestSoFar == null || currentTransform.getCost() < bestSoFar.getCost()) {
      bestSoFar = currentTransform;
    }
View Full Code Here

      } else {
        abort();
      }
      return;
    }
    Artifact candidate = artifactIterator.next();
    if (bestSoFar == null) {
      bestSoFar = getArtifactSimilarity().findTransformScript(candidate, getNewArtifactContent(), -1);
    } else {
      ArtifactSimilarity.TransformInfo ti = getArtifactSimilarity().findTransformScript(candidate, getNewArtifactContent(), bestSoFar.getCost());
      if (ti.getCost() < bestSoFar.getCost()) {
View Full Code Here

    Map<Integer, Token> indexCoveredByToken = new HashMap<Integer, Token>();
    // what is the priority of the covering at a certain index (the longer the covering the higher the priority)
    Map<Integer, Integer> zPriority = new HashMap<Integer, Integer>();
    Tokenizer toResolve = new LineTokenizer(multilineUnknownOrigin);
    for (ArtifactIdentifier artifactIdentifier : listRelatedArtifacts(toResolve)) {
      Artifact artifact = repository.getArtifact(artifactIdentifier);
      TokenAligner aligner = new LineTokenizer(artifact).computeAlignmentTo(toResolve, repository.getTokenIndex());
      List<AlignmentChain> alignments = filterOutPurelyTrivial(repository.getTokenIndex(), aligner.getAlignments());
      updateWithNewAlignmentChains(indexCoveredByToken, zPriority, alignments);
    }
    // convert tokens to Markup
View Full Code Here

    if (target != null) {
      logger.debug("Deleting Grouping: " + target.getName());
      final Date date = actionData.getDate();
      target.visitAllArtifacts(new Grouping.ArtifactVisitListener() {
        public void visit(Grouping grouping, ArtifactIdentifier aid) {
          Artifact obsArt = repository.getArtifact(aid);
          obsArt.setObsoleteDate(date);
          grouping.removeArtifact(obsArt);
        }
      });
      Grouping deleted = repository.removeGrouping(actionData.getSourcePath());
      assert deleted != null;
View Full Code Here

    originalName = originGrouping.getName() + originalName;
    String targetName = actionData.getSourcePath() + originalName.substring(oldPrefix.length());
    String targetGroupingName = targetName.substring(0, targetName.lastIndexOf("/"));
    try {
      ArtifactIdentifier newId = actionData.getRegroupedIdentifier(targetName);
      Artifact oldArtifactWithSameName = repository.getLatestForName(newId.getName(), newId.getBranch());
      if (oldArtifactWithSameName != null && !oldArtifactWithSameName.isObsolete() && oldArtifactWithSameName.getId().getRevision() != newId.getRevision()) {
        // Sanity check: there is already an artifact with that name in the database.
        // This means that a different artifact would be mapped by CollabReview onto the same artifact.
        // This is not good; prevent this.
        // TODO I hope this will detect the problem in the freecol repository which must be somewhere before revision 1952
        throw new IllegalArgumentException("Local name conflict for " + newId);
      }
      Artifact artifact = repository.getArtifact(artifactIdentifier);
      importProgressInfo.setAtomicWorkUnitDescription("Rebranch " + originalName + " as " + targetName + " to " + newId);
      Artifact copy = repository.addArtifact(newId, artifact.getDate(), artifact.getContent(), owner.getOrCreateAuthorForActionData(actionData));
      if (copy != null) {
        // if the artifact was not already there then add it to the respective Grouping
        owner.recursiveCreateGrouping(targetGroupingName).addArtifact(copy);
      }
      repository.commit();
View Full Code Here

        if (oldId.getName().startsWith(branches.oldPrefix)) {
          newName = branches.newPrefix + oldId.getName().substring(branches.oldPrefix.length());
        }
        ArtifactIdentifier newId = new ArtifactIdentifier(newName, actionData.getRevision(), branches.newBranch);
        importProgressInfo.setAtomicWorkUnitDescription("Changing artifact id from " + oldId + " to " + newId);
        Artifact oldArtifact = repository.getArtifact(oldId);
        oldArtifact.setObsoleteDate(actionData.getDate());
        repository.addArtifact(newId, actionData.getDate(), oldArtifact.getContent(), owner.getOrCreateAuthorForActionData(actionData));
      }
    });
  }
View Full Code Here

        authorManager.getAuthor("alice"),
        authorManager.getAuthor("alice")
    };
    artifacts = new Artifact[artifactContent.length];
    for (int i = 0; i < artifacts.length; i++) {
      artifacts[i] = new Artifact(ai[i], artifactAuthor[i], new Date(i), artifactContent[i]);
    }
  }
View Full Code Here

  private TokenbasedSimilarity ls;

  public void setUp() throws Exception {
    CollabReviewSingleton.get();
    a1 = new Artifact(new ArtifactIdentifier("a.java", 1, ""), null, null, s1);
    a2 = new Artifact(new ArtifactIdentifier("a.java", 2, ""), null, null, s2);
    a3 = new Artifact(new ArtifactIdentifier("a.java", 3, ""), null, null, s3);
    a4 = new Artifact(new ArtifactIdentifier("a.java", 4, ""), null, null, s4);
    a5 = new Artifact(new ArtifactIdentifier("a.java", 5, ""), null, null, s5);
    a6 = new Artifact(new ArtifactIdentifier("a.java", 6, ""), null, null, s6);
    a7 = new Artifact(new ArtifactIdentifier("a.java", 7, ""), null, null, s7);
    ls = new TokenbasedSimilarity(new LineTokenizerFactory());
  }
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.Artifact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.