difflib.Patch.addDelta()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中difflib.Patch.addDelta()方法的一些代码示例,展示了Patch.addDelta()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Patch.addDelta()方法的具体详情如下:
包路径:difflib.Patch
类名称:Patch
方法名:addDelta

Patch.addDelta介绍

[英]Add the given delta to this patch
[中]将给定的增量添加到此修补程序

代码示例

代码示例来源:origin: com.qulice/qulice-xml

/**
   * Remove unwanted deltas.
   * @param diff Patch to filter.
   * @return Patch with unwanted deltas removed.
   * @todo #469:30min Remove the method below and find a way to format tags
   *  correctly in XML. Attributes should be indented by 4 spaces, just like
   *  XML tags, but in IT xml-violations there is a tag that our Prettifier
   *  want to be indented by 3 spaces which is wrong. Another problem is
   *  that in the parent tag, attributes are indented to match the first
   *  attribute, this is also wrong - all attributes on new line should be
   *  indented by 4 spaces.
   */
  private static Patch filter(final Patch diff) {
    final Patch patch = new Patch();
    for (final Delta delta : diff.getDeltas()) {
      final List<?> prev = delta.getOriginal().getLines();
      if (
        prev.size() != 1 || delta.getRevised().getLines().size() != 1
          || !XmlValidator.ATTRS_PATTERN
            .matcher(prev.get(0).toString()).matches()
        ) {
        patch.addDelta(delta);
      }
    }
    return patch;
  }
}

代码示例来源:origin: com.googlecode.java-diff-utils/diffutils

patch.addDelta(new ChangeDelta<String>(new Chunk<String>(
        old_ln - 1, oldChunkLines), new Chunk<String>(
        new_ln - 1, newChunkLines)));
patch.addDelta(new ChangeDelta<String>(new Chunk<String>(
    old_ln - 1, oldChunkLines), new Chunk<String>(new_ln - 1,
    newChunkLines)));

代码示例来源:origin: com.custardsource.dybdob/java-diff-utils-copy

patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines),
        new Chunk(new_ln - 1, new_n, newChunkLines)));
    rawChunk.clear();
patch.addDelta(new ChangeDelta(new Chunk(old_ln - 1, old_n, oldChunkLines), new Chunk(
    new_ln - 1, new_n, newChunkLines)));
rawChunk.clear();

代码示例来源:origin: com.googlecode.java-diff-utils/diffutils

patch.addDelta(delta);
if (path.isSnake())
  path = path.prev;

代码示例来源:origin: com.custardsource.dybdob/java-diff-utils-copy

patch.addDelta(delta);
if (path.isSnake())
  path = path.prev;

相关文章