public OID toSubIndex(boolean impliedLength) { byte[] address = new byte[4]; System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4); OID subIndex = new OID(new int[4]); for (int i=0; i<address.length; i++) { subIndex.set(i, address[i] & 0xFF); } return subIndex; }
public OID toSubIndex(boolean impliedLength) { byte[] address = new byte[4]; System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4); OID subIndex = new OID(new int[4]); for (int i=0; i<address.length; i++) { subIndex.set(i, address[i] & 0xFF); } return subIndex; }
public OID toSubIndex(boolean impliedLength) { byte[] address = new byte[4]; System.arraycopy(inetAddress.getAddress(), 0, address, 0, 4); OID subIndex = new OID(new int[4]); for (int i=0; i<address.length; i++) { subIndex.set(i, address[i] & 0xFF); } return subIndex; }
public OID getUpperBound() { OID upperBound = new OID(oid); int lastID = oid.size() - 1; /** * This is not quite correct because we would have to search up the tree * if the last sub ID is 0xFFFFFFFF, but since a table OID must end on 1 * by SMI rules we should be on the safe side here. */ upperBound.set(lastID, oid.get(lastID) + 1); return upperBound; }
public OID getUpperBound() { OID upperBound = new OID(oid); int lastID = oid.size()-1; /** * This is not quite correct because we would have to search up the tree * if the last sub ID is 0xFFFFFFFF, but since a table OID must end on 1 * by SMI rules we should be on the safe side here. */ upperBound.set(lastID, oid.get(lastID)+1); return upperBound; }
/** * Returns the predecessor OID for this OID. * * @return if this OID ends on 0, then a {@link #MAX_OID_LEN} * sub-identifier OID is returned where each sub-ID for index greater * or equal to {@link #size()} is set to {@link #MAX_SUBID_VALUE}. * @since 1.7 */ public final OID predecessor() { if (last() != 0) { int[] pval = new int[MAX_OID_LEN]; System.arraycopy(value, 0, pval, 0, value.length); Arrays.fill(pval, value.length, pval.length, MAX_SUBID_VALUE); OID pred = new OID(pval); pred.set(size() - 1, last() - 1); return pred; } else { OID pred = new OID(this); pred.removeLast(); return pred; } }
/** * Returns the predecessor OID for this OID. * @return * if this OID ends on 0, then a {@link #MAX_OID_LEN} * sub-identifier OID is returned where each sub-ID for index greater * or equal to {@link #size()} is set to {@link #MAX_SUBID_VALUE}. * @since 1.7 */ public final OID predecessor() { if (last() != 0) { int[] pval = new int[MAX_OID_LEN]; System.arraycopy(value, 0, pval, 0, value.length); Arrays.fill(pval, value.length, pval.length, MAX_SUBID_VALUE); OID pred = new OID(pval); pred.set(size()-1, last()-1); return pred; } else { OID pred = new OID(this); pred.removeLast(); return pred; } }
/** * Returns the predecessor OID for this OID. * @return * if this OID ends on 0, then a {@link #MAX_OID_LEN} * sub-identifier OID is returned where each sub-ID for index greater * or equal to {@link #size()} is set to {@link #MAX_SUBID_VALUE}. * @since 1.7 */ public final OID predecessor() { if (last() != 0) { int[] pval = new int[MAX_OID_LEN]; System.arraycopy(value, 0, pval, 0, value.length); Arrays.fill(pval, value.length, pval.length, MAX_SUBID_VALUE); OID pred = new OID(pval); pred.set(size()-1, last()-1); return pred; } else { OID pred = new OID(this); pred.removeLast(); return pred; } }
/** * Returns the next following OID with the same or lesser size (length). * @return OID * the next OID on the same or upper level or a clone of this OID, if * it has a zero length or is 2^32-1. * @since 1.7 */ public final OID nextPeer() { OID next = new OID(this); if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) { next.set(next.size()-1, last()+1); } else if (next.size() > 1) { next.trim(1); next = next.nextPeer(); } return next; }
/** * Returns the next following OID with the same or lesser size (length). * * @return OID * the next OID on the same or upper level or a clone of this OID, if * it has a zero length or is 2^32-1. * @since 1.7 */ public final OID nextPeer() { OID next = new OID(this); if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) { next.set(next.size() - 1, last() + 1); } else if (next.size() > 1) { next.trim(1); next = next.nextPeer(); } return next; }
/** * Returns the next following OID with the same or lesser size (length). * @return OID * the next OID on the same or upper level or a clone of this OID, if * it has a zero length or is 2^32-1. * @since 1.7 */ public final OID nextPeer() { OID next = new OID(this); if ((next.size() > 0) && (last() != MAX_SUBID_VALUE)) { next.set(next.size()-1, last()+1); } else if (next.size() > 1) { next.trim(1); next = nextPeer(); } return next; }