public boolean next(SubRequest request) { MOScope scope = request.getQuery().getScope(); SortedMap<OID, Variable> tail = vbs.tailMap(scope.getLowerBound()); OID first = tail.firstKey(); if (scope.getLowerBound().equals(first) && (!scope.isLowerIncluded())) { if (tail.size() > 1) { Iterator<OID> it = tail.keySet().iterator(); it.next(); first = it.next(); } else { return false; } } if (first != null) { Variable vb = vbs.get(first); if (vb == null) { request.getVariableBinding().setVariable(Null.noSuchInstance); } request.getVariableBinding().setOid(first); request.getVariableBinding().setVariable(vb); request.completed(); return true; } return false; }
public OID find(MOScope range) { SortedMap<OID, Variable> tail = vbs.tailMap(range.getLowerBound()); OID first = tail.firstKey(); if (range.getLowerBound().equals(first) && (!range.isLowerIncluded())) { if (tail.size() > 1) { Iterator<OID> it = tail.keySet().iterator(); it.next(); return it.next(); } } else { return first; } return null; }