本文整理汇总了Java中org.eclipse.compare.rangedifferencer.IRangeComparator类的典型用法代码示例。如果您正苦于以下问题:Java IRangeComparator类的具体用法?Java IRangeComparator怎么用?Java IRangeComparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRangeComparator类属于org.eclipse.compare.rangedifferencer包,在下文中一共展示了IRangeComparator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: skipRangeComparison
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
/**
* Aborts the comparison if the number of tokens is too large.
*
* @param length a number on which to base the decision whether to return
* <code>true</code> or <code>false</code>
* @param maxLength another number on which to base the decision whether to return
* <code>true</code> or <code>false</code>
* @param other the other <code>IRangeComparator</code> to compare with
* @return <code>true</code> to abort a token comparison
*/
public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other) {
if (getRangeCount() < 50 || other.getRangeCount() < 50)
return false;
if (maxLength < 100)
return false;
if (length < 100)
return false;
if (maxLength > 800)
return true;
if (length < maxLength / 4)
return false;
return true;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:30,代码来源:JavaTokenComparator.java
示例2: init
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
private void init(final IRangeComparator left, final IRangeComparator right)
throws FileNotFoundException,
IOException {
final RangeDifference[] diff = RangeDifferencer.findDifferences(left, right);
for (int i = 0; i < diff.length; i++) {
final RangeDifference r = diff[i];
blocks.add(new Block(this, r.leftStart(), r.leftEnd(), r.rightStart(), r.rightEnd()));
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:11,代码来源:Version.java
示例3: rangesEqual
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
@Override
public boolean rangesEqual(final int thisIndex, final IRangeComparator other, final int otherIndex) {
Check.notNull(lines, "lines"); //$NON-NLS-1$
Check.isTrue(thisIndex < lines.length, "thisIndex < lines.length"); //$NON-NLS-1$
Check.notNull(other, "other"); //$NON-NLS-1$
Check.isTrue(other instanceof LineComparator, "other instanceof LineComparatorNew"); //$NON-NLS-1$
final LineComparator otherComparator = (LineComparator) other;
Check.notNull(otherComparator.lines, "otherComparator.lines"); //$NON-NLS-1$
Check.isTrue(otherIndex < otherComparator.lines.length, "otherIndex < otherComparator.lines.length"); //$NON-NLS-1$
final Line thisLine = lines[thisIndex];
final Line otherLine = otherComparator.lines[otherIndex];
if (!thisLine.getLine().equals(otherLine.getLine())) {
return false;
}
/* Compare line endings (optionally) */
if (strictEolEquality && !thisLine.getLineEnding().equals(otherLine.getLineEnding())) {
return false;
}
/* One line has a newline, the other does not */
if (trailingEolDifference
&& (thisLine.getLineEnding() == LineEnding.NONE || otherLine.getLineEnding() == LineEnding.NONE)
&& thisLine.getLineEnding() != otherLine.getLineEnding()) {
return false;
}
return true;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:34,代码来源:LineComparator.java
示例4: rangesEqual
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) {
try {
return getHash(thisIndex).equals(((LineComparator) other).getHash(otherIndex));
} catch (BadLocationException e) {
JavaPlugin.log(e);
return false;
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:LineComparator.java
示例5: rangesEqual
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
/**
* Returns <code>true</code> if a token given by the first index
* matches a token specified by the other <code>IRangeComparator</code> and index.
*
* @param thisIndex the number of the token within this range comparator
* @param other the range comparator to compare this with
* @param otherIndex the number of the token within the other comparator
* @return <code>true</code> if the token are equal
*/
public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) {
if (other != null && getClass() == other.getClass()) {
JavaTokenComparator tc= (JavaTokenComparator) other; // safe cast
int thisLen= getTokenLength(thisIndex);
int otherLen= tc.getTokenLength(otherIndex);
if (thisLen == otherLen)
return fText.regionMatches(false, getTokenStart(thisIndex), tc.fText, tc.getTokenStart(otherIndex), thisLen);
}
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:JavaTokenComparator.java
示例6: rangesEqual
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) {
if (other != null && getClass() == other.getClass()) {
TokenComparator tc= (TokenComparator) other;
int thisLen= getTokenLength(thisIndex);
int otherLen= tc.getTokenLength(otherIndex);
if (thisLen == otherLen)
return fText.regionMatches(false, getTokenStart(thisIndex), tc.fText, tc.getTokenStart(otherIndex), thisLen);
}
return false;
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:11,代码来源:TokenComparator.java
示例7: rangesEqual
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
@Override
public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) {
try {
return getHash(thisIndex).equals(((LineComparator) other).getHash(otherIndex));
} catch (BadLocationException e) {
Log.log(e);
return false;
}
}
开发者ID:fabioz,项目名称:Pydev,代码行数:10,代码来源:LineComparator.java
示例8: skipRangeComparison
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
@Override
public boolean skipRangeComparison(final int length, final int maxLength, final IRangeComparator other) {
return false;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:5,代码来源:LineComparator.java
示例9: skipRangeComparison
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other) {
return false;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:LineComparator.java
示例10: skipRangeComparison
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
public boolean skipRangeComparison(int length, int max, IRangeComparator other) {
if (getRangeCount() < 50 || other.getRangeCount() < 50)
return false;
if (max < 100)
return false;
if (length < 100)
return false;
if (max > 800)
return true;
if (length < max / 4)
return false;
return true;
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:20,代码来源:TokenComparator.java
示例11: skipRangeComparison
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
@Override
public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other) {
return false;
}
开发者ID:fabioz,项目名称:Pydev,代码行数:5,代码来源:LineComparator.java
示例12: getChangedLines
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
/**
* Return all the changed lines.
*
* @param oldDocument a document containing the old content
* @param currentDocument a document containing the current content
* @return the changed regions
* @throws BadLocationException if fetching the line information fails
*/
public static int[] getChangedLines(IDocument oldDocument, IDocument currentDocument) throws BadLocationException {
/*
* Do not change the type of those local variables. We use Object
* here in order to prevent loading of the Compare plug-in at load
* time of this class.
*/
Object leftSide = new LineComparator(oldDocument);
Object rightSide = new LineComparator(currentDocument);
RangeDifference[] differences = RangeDifferencer.findDifferences((IRangeComparator) leftSide,
(IRangeComparator) rightSide);
//It holds that:
//1. Ranges are sorted:
// forAll r1,r2 element differences: indexOf(r1)<indexOf(r2) -> r1.rightStart()<r2.rightStart();
//2. Successive changed lines are merged into on RangeDifference
// forAll r1,r2 element differences: r1.rightStart()<r2.rightStart() -> r1.rightEnd()<r2.rightStart
ArrayList<Integer> regions = new ArrayList<Integer>();
for (int i = 0; i < differences.length; i++) {
RangeDifference curr = differences[i];
if (curr.kind() == RangeDifference.CHANGE && curr.rightLength() > 0) {
int startLine = curr.rightStart();
int endLine = curr.rightEnd() - 1;
if (startLine == endLine) {
regions.add(startLine);
} else {
for (int iLine = startLine; iLine <= endLine; iLine++) {
regions.add(iLine);
}
}
}
}
int size = regions.size();
int[] ret = new int[size];
for (int i = 0; i < size; i++) {
ret[i] = regions.get(i);
}
return ret;
}
开发者ID:fabioz,项目名称:Pydev,代码行数:51,代码来源:ChangedLinesComputer.java
示例13: getDiff
import org.eclipse.compare.rangedifferencer.IRangeComparator; //导入依赖的package包/类
/**
* Compute and return an array of {@link RangeDifference}s for two given strings.
*
* @param left
* @param right
* @return An array of {@link RangeDifference}s.
*/
public static RangeDifference[] getDiff(String left, String right)
{
IRangeComparator leftRangeComparator = new TokenComparator(left);
IRangeComparator rightRangeComparator = new TokenComparator(right);
return RangeDifferencer.findRanges(leftRangeComparator, rightRangeComparator);
}
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:14,代码来源:FormatterUtils.java
注:本文中的org.eclipse.compare.rangedifferencer.IRangeComparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论