当前位置: 首页>>代码示例>>Java>>正文


Java DiffFragment.isOneSide方法代码示例

本文整理汇总了Java中com.intellij.openapi.diff.ex.DiffFragment.isOneSide方法的典型用法代码示例。如果您正苦于以下问题:Java DiffFragment.isOneSide方法的具体用法?Java DiffFragment.isOneSide怎么用?Java DiffFragment.isOneSide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.diff.ex.DiffFragment的用法示例。


在下文中一共展示了DiffFragment.isOneSide方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: unitSameTypes

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
private static DiffFragment[] unitSameTypes(@NotNull DiffFragment[] fragments) {
  if (fragments.length < 2) return fragments;
  DiffCorrection.FragmentsCollector collector = new DiffCorrection.FragmentsCollector();
  DiffFragment previous = fragments[0];
  for (int i = 1; i < fragments.length; i++) {
    DiffFragment fragment = fragments[i];
    if (!fragment.isOneSide() && fragment.getText1().isEmpty() && fragment.getText2().isEmpty()) continue;
    if (Util.isSameType(previous, fragment)) {
      previous = Util.unite(previous, fragment);
    } else {
      collector.add(previous);
      previous = fragment;
    }
  }
  collector.add(previous);
  return collector.toArray();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:UniteSameType.java

示例2: covertSequentialOneSideToChange

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
  private static DiffFragment[] covertSequentialOneSideToChange(@NotNull DiffFragment[] fragments) {
    if (fragments.length < 2) return fragments;
    DiffCorrection.FragmentsCollector collector = new DiffCorrection.FragmentsCollector();
//    DiffFragment previous = fragments[0];
    DiffFragment previous = null;
    for (int i = 0; i < fragments.length; i++) {
      DiffFragment fragment = fragments[i];
      if (fragment.isOneSide()) {
        if (previous == null) previous = fragment;
        else {
          FragmentSide side = FragmentSide.chooseSide(fragment);
          DiffString previousText = side.getText(previous);
          if (previousText == null) previousText = DiffString.EMPTY;
          previous = side.createFragment(DiffString.concatenateNullable(previousText, side.getText(fragment)),
                                         side.getOtherText(previous), true);
        }
      } else {
        if (previous != null) collector.add(previous);
        previous = null;
        collector.add(fragment);
      }
    }
    if (previous != null) collector.add(previous);
    return collector.toArray();
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:UniteSameType.java

示例3: divide

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public DiffFragment[][] divide(DiffFragment[] lineBlock) {
  List2D result = new List2D();
  FragmentSide currentSide = null;
  boolean isNewLineLast = true;
  for (int i = 0; i < lineBlock.length; i++) {
    DiffFragment fragment = lineBlock[i];
    if (!fragment.isOneSide()) {
      if (currentSide != null && isNewLineLast) result.newRow();
      isNewLineLast = StringUtil.endsWithChar(fragment.getText1(), '\n') && StringUtil.endsWithChar(fragment.getText2(), '\n');
      currentSide = null;
    } else {
      FragmentSide side = FragmentSide.chooseSide(fragment);
      if (currentSide != side) {
        if (isNewLineLast) {
          result.newRow();
          currentSide = side;
        } else currentSide = null;
      }
      isNewLineLast = StringUtil.endsWithChar(side.getText(fragment), '\n');
    }
    result.add(fragment);
  }
  return result.toArray();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LineBlockDivider.java

示例4: process

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@Override
public void process(@NotNull DiffFragment fragment, @NotNull DiffCorrection.FragmentsCollector collector) {
  if (fragment.isEqual()) {
    collector.add(fragment);
    return;
  }
  if (fragment.isOneSide()) {
    FragmentSide side = FragmentSide.chooseSide(fragment);
    DiffString text = side.getText(fragment);
    if (StringUtil.isEmptyOrSpaces(text)) {
      collector.add(side.createFragment(text, DiffString.EMPTY, false));
      return;
    }
  }
  collector.add(fragment);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ComparisonPolicy.java

示例5: process

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@Override
public void process(@NotNull DiffFragment fragment, @NotNull FragmentBuffer buffer) {
  if (fragment.isEqual()) buffer.add(fragment);
  else if (fragment.isOneSide()) {
    DiffString text = FragmentSide.chooseSide(fragment).getText(fragment);
    if (StringUtil.endsWithChar(text, '\n'))
      buffer.add(fragment);
    else
      buffer.markIfNone(CHANGE);
  } else buffer.markIfNone(CHANGE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DiffCorrection.java

示例6: addTails

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public void addTails() throws FilesTooBigForDiffException {
  DiffString tail1 = myVersion1.getNotProcessedTail();
  DiffString tail2 = myVersion2.getNotProcessedTail();
  if (tail1.isEmpty() && tail2.isEmpty()) return;
  DiffFragment[] fragments = fragmentsByChar(tail1, tail2);
  if (!myFragments.isEmpty()) {
    DiffFragment lastFragment = myFragments.get(myFragments.size() - 1);
    if (lastFragment.isChange()) {
      int oneSideCount = 0;
      while (oneSideCount < fragments.length && fragments[oneSideCount].isOneSide()) oneSideCount++;
      if (oneSideCount > 0) {
        myFragments.remove(myFragments.size() - 1);
        DiffFragment[] onesideFragments = new DiffFragment[oneSideCount];
        DiffFragment[] otherFragments = new DiffFragment[fragments.length - oneSideCount];
        System.arraycopy(fragments, 0, onesideFragments, 0, oneSideCount);
        System.arraycopy(fragments, oneSideCount, otherFragments, 0, otherFragments.length);
        DiffFragment startingOneSides = UniteSameType.uniteAll(onesideFragments);
        if (startingOneSides.isOneSide()) {
          myFragments.add(lastFragment);
          add(startingOneSides);
        } else {
          lastFragment = Util.unite(lastFragment, startingOneSides);
          myFragments.add(lastFragment);
        }
        fragments = otherFragments;
      }
    }
  }
  addAll(fragments);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ByWord.java

示例7: unite

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
@NotNull
public static DiffFragment unite(@NotNull DiffFragment fragment1, @NotNull DiffFragment fragment2) {
  LOG.assertTrue(isSameType(fragment1, fragment2));
  if (!fragment1.isOneSide()) {
    DiffString unitedText1 = DiffString.concatenateNullable(fragment1.getText1(), fragment2.getText1());
    DiffString unitedText2 = DiffString.concatenateNullable(fragment1.getText2(), fragment2.getText2());
    LOG.assertTrue(fragment1.isEqual() == fragment2.isEqual());
    return fragment1.isEqual() ? DiffFragment.unchanged(unitedText1, unitedText2) :
        new DiffFragment(unitedText1, unitedText2);
  }
  FragmentSide side = FragmentSide.chooseSide(fragment1);
  return side
    .createFragment(DiffString.concatenateNullable(side.getText(fragment1), side.getText(fragment2)), null, fragment1.isModified());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:Util.java

示例8: isEqual

import com.intellij.openapi.diff.ex.DiffFragment; //导入方法依赖的package包/类
public boolean isEqual(@NotNull DiffFragment fragment) {
  if (fragment.isOneSide()) return false;
  Object[] wrappers = getLineWrappers(new DiffString[]{fragment.getText1(), fragment.getText2()});
  return Comparing.equal(wrappers[0], wrappers[1]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ComparisonPolicy.java


注:本文中的com.intellij.openapi.diff.ex.DiffFragment.isOneSide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。