本文整理汇总了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;
}