/** * Returns the greater of the two OID values. * * @param a an OID. * @param b an OID. * @return {@code a} if a >= b, {@code b} otherwise. * @since 1.7 */ public static OID max(OID a, OID b) { if (a.compareTo(b) >= 0) { return a; } return b; }
/** * Returns the lesser of the two OID values. * * @param a an OID. * @param b an OID. * @return {@code a} if a <= b, {@code b} otherwise. * @since 1.7 */ public static OID min(OID a, OID b) { if (a.compareTo(b) <= 0) { return a; } return b; }
/** * Returns the lesser of the two OID values. * @param a * an OID. * @param b * an OID. * @return * {@code a} if a <= b, {@code b} otherwise. * @since 1.7 */ public static OID min(OID a, OID b) { if (a.compareTo(b) <= 0) { return a; } return b; }
/** * Returns the greater of the two OID values. * @param a * an OID. * @param b * an OID. * @return * <code>a</code> if a >= b, <code>b</code> otherwise. * @since 1.7 */ public static final OID max(OID a, OID b) { if (a.compareTo(b) >= 0) { return a; } return b; }
/** * Returns the greater of the two OID values. * @param a * an OID. * @param b * an OID. * @return * {@code a} if a >= b, {@code b} otherwise. * @since 1.7 */ public static OID max(OID a, OID b) { if (a.compareTo(b) >= 0) { return a; } return b; }
/** * Returns the lesser of the two OID values. * @param a * an OID. * @param b * an OID. * @return * <code>a</code> if a <= b, <code>b</code> otherwise. * @since 1.7 */ public static final OID min(OID a, OID b) { if (a.compareTo(b) <= 0) { return a; } return b; }
/** * Compare two BindEntries. Ordering is defined at oid-level. * * @param other * The BindEntry to compare to. * @return 0 on equals, 1 if this is bigger than other */ public int compareTo(Object other) { if (other == null) throw new NullPointerException("Can't compare to NULL"); if (!(other instanceof BindEntry)) throw new ClassCastException("Parameter is no BindEntry"); // trivial case if (this.equals(other)) return 0; BindEntry obe = (BindEntry) other; // if (getOid().equals(obe.getOid())) // return 0; int res = oid.compareTo(obe.getOid()); return res; }
/** * Compare two BindEntries. Ordering is defined at oid-level. * * @param other * The BindEntry to compare to. * @return 0 on equals, 1 if this is bigger than other */ public int compareTo(Object other) { if (other == null) throw new NullPointerException("Can't compare to NULL"); if (!(other instanceof BindEntry)) throw new ClassCastException("Parameter is no BindEntry"); // trivial case if (this.equals(other)) return 0; BindEntry obe = (BindEntry) other; // if (getOid().equals(obe.getOid())) // return 0; int res = oid.compareTo(obe.getOid()); return res; }
public synchronized void removeRows(OID lowerBoundIncl, OID upperBoundExcl) { Map<OID, R> m = (lowerBoundIncl == null) ? rows : rows.tailMap(lowerBoundIncl); for (Iterator<Map.Entry<OID, R>> it = m.entrySet().iterator(); it.hasNext(); ) { Map.Entry<OID, R> item = it.next(); if ((upperBoundExcl == null) || (upperBoundExcl.compareTo(item.getKey()) > 0)) { if (moTableModelListeners != null) { MOTableModelEvent event = new MOTableModelEvent(this, MOTableModelEvent.ROW_REMOVED, item.getValue()); fireTableModelChanged(event); } it.remove(); } else { break; } } }
public synchronized void removeRows(OID lowerBoundIncl, OID upperBoundExcl) { Map m = (lowerBoundIncl == null) ? rows : rows.tailMap(lowerBoundIncl); for (Iterator it = m.entrySet().iterator(); it.hasNext(); ) { Map.Entry item = (Map.Entry) it.next(); if (upperBoundExcl == null || upperBoundExcl.compareTo(item.getKey()) > 0) { if (moTableModelListeners != null) { MOTableModelEvent event = new MOTableModelEvent(this, MOTableModelEvent.ROW_REMOVED, (MOTableRow)item.getValue()); fireTableModelChanged(event); } it.remove(); } else { break; } } }
/** * Compares this row with a {@link MOTableRow} instance * by their index values. * @param o * a {@link MOTableRow} instance * @return * <code>getIndex().compareTo(o.getIndex())</code> */ public int compareTo(Object o) { return getIndex().compareTo(((MOTableRow)o).getIndex()); } }
@Override public int compare(MOTableRow o1, MOTableRow o2) { return o1.getIndex().compareTo(o2.getIndex()); } }
/** * Compares this row with a {@link MOTableRow} instance * by their index values. * @param o * a {@link MOTableRow} instance * @return * <code>getIndex().compareTo(o.getIndex())</code> */ public int compareTo(Object o) { return getIndex().compareTo(((MOTableRow)o).getIndex()); } }
public void substractScope(MOScope scope) { if (lowerBound.compareTo(scope.getUpperBound()) <= 0) { lowerBound = scope.getUpperBound(); lowerIncluded = !scope.isUpperIncluded(); } }
public void substractScope(MOScope scope) { if (lowerBound.compareTo(scope.getUpperBound()) <= 0) { lowerBound = scope.getUpperBound(); lowerIncluded = !scope.isUpperIncluded(); } }
/** * Checks if this scope is empty or not. An empty scope cannot cover any * OID (i.e. lower bound is greater than upper bound). * @return * <code>true</code> if lower bound is greater than upper bound or if * both bounds equal but one of the bounds is not-included. */ public boolean isEmpty() { return (((lowerBound != null) && (upperBound != null)) && ((lowerBound.compareTo(upperBound) > 0) || (lowerBound.equals(upperBound) && !(isLowerIncluded() && isUpperIncluded())))); }
/** * Checks if this scope is empty or not. An empty scope cannot cover any * OID (i.e. lower bound is greater than upper bound). * @return * <code>true</code> if lower bound is greater than upper bound or if * both bounds equal but one of the bounds is not-included. */ public boolean isEmpty() { return (((lowerBound != null) && (upperBound != null)) && ((lowerBound.compareTo(upperBound) > 0) || (lowerBound.equals(upperBound) && !(isLowerIncluded() && isUpperIncluded())))); }
private static int compareQueryWithScope(MOScope scope, MOQuery scope2) { int result = 0; if (scope.getUpperBound() == null) { return 1; } else { result = scope.getUpperBound().compareTo(scope2.getLowerBound()); if (result == 0) { if ((!scope.isUpperIncluded()) || (!scope2.isLowerIncluded())) { return -1; } } } if (result == 0) { if (scope instanceof MOContextScope) { OctetString c1 = ((MOContextScope)scope).getContext(); OctetString c2 = scope2.getContext(); if ((c1 != null) && (c2 != null)) { result = c1.compareTo(c2); } } } return result; }