本文整理匯總了Java中org.antlr.v4.runtime.misc.Interval.disjoint方法的典型用法代碼示例。如果您正苦於以下問題:Java Interval.disjoint方法的具體用法?Java Interval.disjoint怎麽用?Java Interval.disjoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.antlr.v4.runtime.misc.Interval
的用法示例。
在下文中一共展示了Interval.disjoint方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processAlternatives
import org.antlr.v4.runtime.misc.Interval; //導入方法依賴的package包/類
private void processAlternatives(List<? extends AlternativeContext> alternatives) {
if (alternatives.size() <= 1) {
return;
}
String label = null;
for (AlternativeContext alternative : alternatives) {
Set<String> labels = _labels.get(alternative);
if (labels == null || labels.size() != 1) {
return;
}
if (label == null) {
label = labels.iterator().next();
} else if (!label.equals(labels.iterator().next())) {
return;
}
}
Interval rewriteInterval = new Interval(alternatives.get(0).getSourceInterval().a, alternatives.get(alternatives.size() - 1).getSourceInterval().b);
for (Interval interval : _ignoreRanges.getIntervals()) {
if (!interval.disjoint(rewriteInterval)) {
return;
}
}
TerminalNode firstNode = ParseTrees.getStartNode(alternatives.get(0));
TerminalNode lastNode = ParseTrees.getStopNode(alternatives.get(alternatives.size() - 1));
int startIndex = firstNode.getSymbol().getStartIndex();
int stopIndex = lastNode.getSymbol().getStopIndex();
_rewriteRanges.add(startIndex, stopIndex);
}
示例2: isIgnored
import org.antlr.v4.runtime.misc.Interval; //導入方法依賴的package包/類
private boolean isIgnored(ParseTree ctx) {
Interval interval = ctx.getSourceInterval();
for (Interval ignored : _ignoreRanges.getIntervals()) {
if (!ignored.disjoint(interval)) {
return true;
}
}
return false;
}