org.snmp4j.agent
Class MOScopeComparator

java.lang.Object
  extended by org.snmp4j.agent.MOScopeComparator
All Implemented Interfaces:
java.util.Comparator

public class MOScopeComparator
extends java.lang.Object
implements java.util.Comparator

The MOScopeComparator compares two scopes with each other or it compares a scope and a MOQuery with each other.

Two scopes are compared by their context (if both are MOContextScope instances) first and then by their lower bound.

A scope is compared with a query by comparing the scope with the queries scope and then if both are deemed to be equal, the upper bound of the scope is checked. If it is unbounded (upper bound is null

Version:
1.0
Author:
Frank Fock

Constructor Summary
MOScopeComparator()
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares a scope with another scope or query.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MOScopeComparator

public MOScopeComparator()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares a scope with another scope or query. See also the class description how comparison is done.

Specified by:
compare in interface java.util.Comparator
Parameters:
o1 - a MOscope or MOQuery instance.
o2 - a MOscope or MOQuery instance.
Returns:
an integer less than zero if o1 is less than o2 and zero if both values are deemed to be equal and a value greater than zero if o1 is greater than o2.

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Copyright 2005-2008 Frank Fock (SNMP4J.org)