public static List<? extends CoreMap> replaceMerged(List<? extends CoreMap> list, List<? extends MatchedExpression> matchedExprs) { if (matchedExprs == null) return list; matchedExprs.sort(EXPR_TOKEN_OFFSET_COMPARATOR); List<CoreMap> merged = new ArrayList<>(list.size()); // Approximate size int last = 0; for (MatchedExpression expr:matchedExprs) { int start = expr.chunkOffsets.first(); int end = expr.chunkOffsets.second(); if (start >= last) { merged.addAll(list.subList(last,start)); CoreMap m = expr.getAnnotation(); merged.add(m); last = end; } } // Add rest of elements if (last < list.size()) { merged.addAll(list.subList(last, list.size())); } return merged; }
for (MatchedExpression expr:matchedExprs) { int start = expr.tokenOffsets.first(); int end = expr.tokenOffsets.second(); Integer istart = tokenBeginToListIndexMap.get(start); Integer iend = tokenEndToListIndexMap.get(end);
/** * Return set of flags indicating possible relationships between * this interval and another interval. * * @param other Interval with which to compare with * @return flags indicating possible relationship between this interval and the other interval */ public int getRelationFlags(Interval<E> other) { if (other == null) return 0; int flags = 0; int comp11 = this.first.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp11, REL_FLAGS_SS_SHIFT); int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); int comp21 = this.second.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp21, REL_FLAGS_ES_SHIFT); flags = addIntervalRelationFlags(flags, false); return flags; }
/** * Check whether this interval overlaps with the other interval. * (I.e. the intersect would not be null.) * * @param other interval to compare with * @return true if this interval overlaps the other interval */ public boolean overlaps(Interval<E> other) { if (other == null) return false; int comp12 = this.first.compareTo(other.second()); int comp21 = this.second.compareTo(other.first()); if (comp12 > 0 || comp21 < 0) { return false; } else { if (comp12 == 0) { if (!this.includesBegin() || !other.includesEnd()) { return false; } } if (comp21 == 0) { if (!this.includesEnd() || !other.includesBegin()) { return false; } } return true; } }
hasUnknown = true; if (this.second.isComparable(other.second())) { int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); } else { hasUnknown = true; if (this.first.isComparable(other.second())) { int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); } else {
public static List<? extends CoreMap> replaceMerged(List<? extends CoreMap> list, List<? extends MatchedExpression> matchedExprs) { if (matchedExprs == null) return list; matchedExprs.sort(EXPR_TOKEN_OFFSET_COMPARATOR); List<CoreMap> merged = new ArrayList<>(list.size()); // Approximate size int last = 0; for (MatchedExpression expr:matchedExprs) { int start = expr.chunkOffsets.first(); int end = expr.chunkOffsets.second(); if (start >= last) { merged.addAll(list.subList(last,start)); CoreMap m = expr.getAnnotation(); merged.add(m); last = end; } } // Add rest of elements if (last < list.size()) { merged.addAll(list.subList(last, list.size())); } return merged; }
private List<? extends CoreMap> replaceMerged(List<? extends CoreMap> list, List<TimeExpression> timeExprs) { Collections.sort(timeExprs, TIME_EXPR_TOKEN_OFFSET_COMPARATOR); List<CoreMap> merged = new ArrayList<CoreMap>(list.size()); // Approximate size int last = 0; for (TimeExpression timeExpr:timeExprs) { int start = timeExpr.chunkOffsets.first(); int end = timeExpr.chunkOffsets.second(); if (start >= last) { merged.addAll(list.subList(last,start)); CoreMap m = timeExpr.getAnnotation(); merged.add(m); last = end; } } // Add rest of elements if (last < list.size()) { merged.addAll(list.subList(last, list.size())); } return merged; }
public static List<? extends CoreMap> replaceMerged(List<? extends CoreMap> list, List<? extends MatchedExpression> matchedExprs) { if (matchedExprs == null) return list; matchedExprs.sort(EXPR_TOKEN_OFFSET_COMPARATOR); List<CoreMap> merged = new ArrayList<>(list.size()); // Approximate size int last = 0; for (MatchedExpression expr:matchedExprs) { int start = expr.chunkOffsets.first(); int end = expr.chunkOffsets.second(); if (start >= last) { merged.addAll(list.subList(last,start)); CoreMap m = expr.getAnnotation(); merged.add(m); last = end; } } // Add rest of elements if (last < list.size()) { merged.addAll(list.subList(last, list.size())); } return merged; }
public static List<? extends CoreMap> replaceMerged(List<? extends CoreMap> list, List<? extends MatchedExpression> matchedExprs) { if (matchedExprs == null) return list; Collections.sort(matchedExprs, EXPR_TOKEN_OFFSET_COMPARATOR); List<CoreMap> merged = new ArrayList<CoreMap>(list.size()); // Approximate size int last = 0; for (MatchedExpression expr:matchedExprs) { int start = expr.chunkOffsets.first(); int end = expr.chunkOffsets.second(); if (start >= last) { merged.addAll(list.subList(last,start)); CoreMap m = expr.getAnnotation(); merged.add(m); last = end; } } // Add rest of elements if (last < list.size()) { merged.addAll(list.subList(last, list.size())); } return merged; }
public int getRelationFlags(Interval<E> other) { if (other == null) return 0; int flags = 0; int comp11 = this.first.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp11, REL_FLAGS_SS_SHIFT); int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); int comp21 = this.second.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp21, REL_FLAGS_ES_SHIFT); flags = addIntervalRelationFlags(flags, false); return flags; }
for (MatchedExpression expr:matchedExprs) { int start = expr.tokenOffsets.first(); int end = expr.tokenOffsets.second(); Integer istart = tokenBeginToListIndexMap.get(start); Integer iend = tokenEndToListIndexMap.get(end);
/** * Return set of flags indicating possible relationships between * this interval and another interval. * * @param other Interval with which to compare with * @return flags indicating possible relationship between this interval and the other interval */ public int getRelationFlags(Interval<E> other) { if (other == null) return 0; int flags = 0; int comp11 = this.first.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp11, REL_FLAGS_SS_SHIFT); int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); int comp21 = this.second.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp21, REL_FLAGS_ES_SHIFT); flags = addIntervalRelationFlags(flags, false); return flags; }
/** * Return set of flags indicating possible relationships between * this interval and another interval. * * @param other Interval with which to compare with * @return flags indicating possible relationship between this interval and the other interval */ public int getRelationFlags(Interval<E> other) { if (other == null) return 0; int flags = 0; int comp11 = this.first.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp11, REL_FLAGS_SS_SHIFT); int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); int comp21 = this.second.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp21, REL_FLAGS_ES_SHIFT); flags = addIntervalRelationFlags(flags, false); return flags; }
/** * Return set of flags indicating possible relationships between * this interval and another interval. * * @param other Interval with which to compare with * @return flags indicating possible relationship between this interval and the other interval */ public int getRelationFlags(Interval<E> other) { if (other == null) return 0; int flags = 0; int comp11 = this.first.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp11, REL_FLAGS_SS_SHIFT); int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); int comp21 = this.second.compareTo(other.first()); // 3 choices flags |= toRelFlags(comp21, REL_FLAGS_ES_SHIFT); flags = addIntervalRelationFlags(flags, false); return flags; }
/** * Check whether this interval overlaps with the other interval. * (I.e. the intersect would not be null.) * * @param other interval to compare with * @return true if this interval overlaps the other interval */ public boolean overlaps(Interval<E> other) { if (other == null) return false; int comp12 = this.first.compareTo(other.second()); int comp21 = this.second.compareTo(other.first()); if (comp12 > 0 || comp21 < 0) { return false; } else { if (comp12 == 0) { if (!this.includesBegin() || !other.includesEnd()) { return false; } } if (comp21 == 0) { if (!this.includesEnd() || !other.includesBegin()) { return false; } } return true; } }
public boolean overlaps(Interval<E> other) { if (other == null) return false; int comp12 = this.first.compareTo(other.second()); int comp21 = this.second.compareTo(other.first()); if (comp12 > 0 || comp21 < 0) { return false; } else { if (comp12 == 0) { if (!this.includesBegin() || !other.includesEnd()) { return false; } } if (comp21 == 0) { if (!this.includesEnd() || !other.includesBegin()) { return false; } } return true; } }
/** * Check whether this interval overlaps with the other interval. * (I.e. the intersect would not be null.) * * @param other interval to compare with * @return true if this interval overlaps the other interval */ public boolean overlaps(Interval<E> other) { if (other == null) return false; int comp12 = this.first.compareTo(other.second()); int comp21 = this.second.compareTo(other.first()); if (comp12 > 0 || comp21 < 0) { return false; } else { if (comp12 == 0) { if (!this.includesBegin() || !other.includesEnd()) { return false; } } if (comp21 == 0) { if (!this.includesEnd() || !other.includesBegin()) { return false; } } return true; } }
/** * Check whether this interval overlaps with the other interval * (i.e. the intersect would not be null) * @param other interval to compare with * @return true if this interval overlaps the other interval */ public boolean overlaps(Interval<E> other) { if (other == null) return false; int comp12 = this.first.compareTo(other.second()); int comp21 = this.second.compareTo(other.first()); if (comp12 > 0 || comp21 < 0) { return false; } else { if (comp12 == 0) { if (!this.includesBegin() || !other.includesEnd()) { return false; } } if (comp21 == 0) { if (!this.includesEnd() || !other.includesBegin()) { return false; } } return true; } }
hasUnknown = true; if (this.second.isComparable(other.second())) { int comp22 = this.second.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp22, REL_FLAGS_EE_SHIFT); } else { hasUnknown = true; if (this.first.isComparable(other.second())) { int comp12 = this.first.compareTo(other.second()); // 3 choices flags |= toRelFlags(comp12, REL_FLAGS_SE_SHIFT); } else {