Package net.sf.collabreview.core.markup

Examples of net.sf.collabreview.core.markup.TrivialLineMarkup


      Token covering = indexCoveredByToken.get(covered.getStartIndex());
      List<MarkupElement> mel;
      if (covering == null) {
        mel = new ArrayList<MarkupElement>(3);
        if (repository.getTokenIndex().isTrivialToken(covered)) {
          mel.add(new TrivialLineMarkup(covered.getStartIndex(), covered.getEndIndex()));
        } else {
          mel.add(new InsertedByEditScriptMarkup(covered.getStartIndex(), covered.getEndIndex()));
        }
      } else {
        mel = covered.toOriginMarkupElements(covering);
View Full Code Here


  }

  public void testChainOrigin() throws Exception {
    List<MarkupElement> expected = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 4, ai[6], 17, 21, 1),
        new TrivialLineMarkup(4, 5),
        new OriginMarkup(5, 7, ai[6], 23, 25, 1),
        new TrivialLineMarkup(7, 8),
        new OriginMarkup(8, 9, ai[6], 27, 28, 1)
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter.NoneTrivialFilter());
    repository.addArtifact(ai[6], new Date(), artifactContent[6], artifactAuthor[6]);
    TokenOriginSearch tos = new TokenOriginSearch(repository);
View Full Code Here

   * @throws Exception if there is a problem while accessing the repository
   */
  public void testChainOriginDeleteTrivial() throws Exception {
    List<MarkupElement> expected = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 4, ai[7], 0, 4, 1), // Free
        new TrivialLineMarkup(4, 5),
        new OriginMarkup(5, 10, ai[6], 11, 16, 1), // World
        new TrivialLineMarkup(10, 11),
        new OriginMarkup(11, 15, ai[6], 17, 21, 1), // this
        new TrivialLineMarkup(15, 16),
        new TrivialLineMarkup(16, 26), // [trivial]
        new OriginMarkup(26, 28, ai[6], 23, 25, 1), // is
        new TrivialLineMarkup(28, 29),
        new OriginMarkup(29, 30, ai[6], 27, 28, 1), // a
        new TrivialLineMarkup(30, 31),
        new OriginMarkup(31, 35, ai[6], 29, 33, 1)// test
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter() {
      public boolean isTrivialToken(Token token) {
        return "[trivial]".equals(token.getCore());
View Full Code Here

   * @throws Exception if there is a problem while accessing the repository
   */
  public void testAddTrivial() throws Exception {
    List<MarkupElement> expected = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 4, ai[6], 17, 21, 1),
        new TrivialLineMarkup(4, 5),
        new OriginMarkup(5, 7, ai[6], 23, 25, 1),
        new TrivialLineMarkup(7, 8),
        new TrivialLineMarkup(8, 11),
        new TrivialLineMarkup(11, 14),
        new OriginMarkup(14, 15, ai[6], 27, 28, 1)
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter() {
      public boolean isTrivialToken(Token token) {
        return token.getCore().charAt(0) == '_';
View Full Code Here

   * @see TokenAlignerTest#testInsertTrivial()
   */
  public void testChainOriginAddTrivial() throws Exception {
    List<MarkupElement> expected = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 4, ai[7], 0, 4, 1)// free
        new TrivialLineMarkup(4, 5),
        new OriginMarkup(5, 10, ai[6], 11, 16, 1), // world
        new TrivialLineMarkup(10, 11),
        new OriginMarkup(11, 15, ai[6], 17, 21, 1), // this
        new TrivialLineMarkup(15, 16),
        new OriginMarkup(16, 18, ai[6], 23, 25, 1), // is
        new TrivialLineMarkup(18, 19),
        new TrivialLineMarkup(19, 22), // _2
        new TrivialLineMarkup(22, 25), // _1
        new OriginMarkup(25, 26, ai[6], 27, 28, 1), // a
        new TrivialLineMarkup(26, 27),
        new OriginMarkup(27, 31, ai[6], 29, 33, 1) // test
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter() {
      public boolean isTrivialToken(Token token) {
        return token.getCore().length() == 0 || token.getCore().charAt(0) == '_';
View Full Code Here

   * @throws Exception if there is a problem while accessing the repository
   */
  public void testIdentifyLongestForOverlay() throws Exception {
    List<MarkupElement> expected1 = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 5, ai[1], 1, 6, 1),
        new TrivialLineMarkup(5, 6),
        new OriginMarkup(6, 11, ai[1], 10, 15, 1)
    ));
    List<MarkupElement> expected2 = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 5, ai[6], 5, 10, 1),
        new TrivialLineMarkup(5, 6),
        new OriginMarkup(6, 11, ai[6], 11, 16, 1)
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter.NoneTrivialFilter());
    addAllArtifacts();
    TokenOriginSearch tos = new TokenOriginSearch(repository);
View Full Code Here

   * @throws Exception if there is a problem while accessing the repository
   */
  public void testWhitespaceInGapToResolve() throws Exception {
    List<MarkupElement> expected = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 4, ai[6], 17, 21, 1),
        new TrivialLineMarkup(4, 8),
        new TrivialLineMarkup(8, 9),
        new OriginMarkup(9, 11, ai[6], 23, 25, 1),
        new TrivialLineMarkup(11, 12),
        new TrivialLineMarkup(12, 14),
        new OriginMarkup(14, 15, ai[6], 27, 28, 1)
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter.NoneTrivialFilter());
    repository.addArtifact(ai[6], new Date(), artifactContent[6], artifactAuthor[6]);
    TokenOriginSearch tos = new TokenOriginSearch(repository);
View Full Code Here

   * @throws Exception if there is a problem while accessing the repository
   */
  public void _testChainOriginSubstituteTrivialWithNewTrivial() throws Exception {
    List<MarkupElement> expected = new ArrayList<MarkupElement>(Arrays.asList(
        new OriginMarkup(0, 4, ai[7], 0, 4, 1), // free
        new TrivialLineMarkup(4, 5),
        new OriginMarkup(5, 10, ai[7], 5, 10, 1), // world
        new TrivialLineMarkup(10, 11),
        new InsertedByEditScriptMarkup(11, 15), // xxx
        new TrivialLineMarkup(14, 15),
        new OriginMarkup(15, 17, ai[7], 16, 18, 1), // is
        new TrivialLineMarkup(17, 18),
        new OriginMarkup(18, 19, ai[6], 27, 28, 1)
    ));
    repository.setTrivialTokenFilter(new TrivialTokenFilter() {
      public boolean isTrivialToken(Token token) {
        return "this".equals(token.getCore()) || "xxx".equals(token.getCore());
View Full Code Here

    // 3. Trailing white-space: coreOffset+core.length to token.endIndex-token.startIndex
    int tokenEnd = token.getEndIndex() - token.getStartIndex();
    // left rim
    List<MarkupElement> result = new ArrayList<MarkupElement>(3);
    if (coreStart != 0) {
      result.add(new TrivialLineMarkup(0, coreStart));
    }
    // the core
    if (token.getCore().length() != 0) {
      result.add(new OriginMarkup(
          coreStart,
          coreEnd,
          origin.getTokenizer().getOriginalArtifact(),
          origin.getStartIndex() + origin.getCoreOffset(),
          origin.getStartIndex() + origin.getCoreOffset() + origin.getCore().length(),
          1
      ));
    }
    // right rim
    if (tokenEnd - coreEnd != 0) {
      result.add(new TrivialLineMarkup(coreEnd, tokenEnd));
    }
    return result;
  }
View Full Code Here

    assertEquals(aid, aid2);
  }

  public void testLoadArtifactInSameSession() {
    Artifact a = new HibernateArtifact(createIdentifier(1), null, new Date(), "bula bula");
    MarkupElement me = new TrivialLineMarkup(0, 5);
    a.getMarkup().add(me);
    HibernateUtil.save(a);
    HibernateUtil.commit();
    Artifact loaded = (Artifact) HibernateUtil.getCurrentSession().get(HibernateArtifact.class, a.getId().getPk());
    assertNotNull(loaded);
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.markup.TrivialLineMarkup

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.