org.jboss.jmx.adaptor.snmp.agent
Class ComparableSnmpObjectId

java.lang.Object
  extended by org.opennms.protocols.snmp.SnmpObjectId
      extended by org.jboss.jmx.adaptor.snmp.agent.ComparableSnmpObjectId
All Implemented Interfaces:
Serializable, Cloneable, Comparable, org.opennms.protocols.snmp.SnmpSyntax

public class ComparableSnmpObjectId
extends org.opennms.protocols.snmp.SnmpObjectId
implements Comparable

Provide SnmpObjectIds that are Comparable to be used in SortedSets etc.

Version:
$Revision: 57210 $
Author:
Heiko W. Rupp
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.opennms.protocols.snmp.SnmpObjectId
ASNTYPE
 
Constructor Summary
ComparableSnmpObjectId(int[] identifiers)
           
ComparableSnmpObjectId(org.opennms.protocols.snmp.SnmpObjectId oid)
           
ComparableSnmpObjectId(String oid)
           
 
Method Summary
 int compareTo(Object o)
          Compare to the passed object.
 ComparableSnmpObjectId getNextArc()
          Build an oid where the second last component (after removing a .0 of a leaf) is increased by 1.
 boolean isLeaf()
          This object is a leaf if the last part of the oid parts is a 0 (Zero)
 ComparableSnmpObjectId removeLastPart()
          Removes the last oid-component.
 
Methods inherited from class org.opennms.protocols.snmp.SnmpObjectId
append, append, append, clone, compare, compare, compare, decodeASN, duplicate, encodeASN, equals, getIdentifiers, getLength, hashCode, isRootOf, prepend, prepend, prepend, setIdentifiers, setIdentifiers, toString, typeId
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComparableSnmpObjectId

public ComparableSnmpObjectId(String oid)

ComparableSnmpObjectId

public ComparableSnmpObjectId(org.opennms.protocols.snmp.SnmpObjectId oid)

ComparableSnmpObjectId

public ComparableSnmpObjectId(int[] identifiers)
Method Detail

compareTo

public int compareTo(Object o)
Compare to the passed object. Uses compare() from the underlying snmp-library

Specified by:
compareTo in interface Comparable
Parameters:
o - Object to compare with (Usually a ComparableSnmpObjectId)
Returns:
-1, if no SnmpObjectId passed in, the result of the underlying compare otherwise.
See Also:
SnmpObjectId.compare()

isLeaf

public boolean isLeaf()
This object is a leaf if the last part of the oid parts is a 0 (Zero)

Returns:
true if the oid ends in 0

removeLastPart

public ComparableSnmpObjectId removeLastPart()
Removes the last oid-component. Example .1.2.3.4.0 as input yields .1.2.3.4 as output

Returns:
an oid with the last part removed.

getNextArc

public ComparableSnmpObjectId getNextArc()
Build an oid where the second last component (after removing a .0 of a leaf) is increased by 1. The last component is removed, to the result actually forms the root of a subtree, that is adjacent to the subtree this object is in. Example .1.2.3.4.0 -> .1.2.4 Example .1.2.3.4.5 -> .1.2.4

Returns:


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.