org.snmp4j.agent
Class MOScopeComparator

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

public class MOScopeComparator
extends java.lang.Object
implements java.util.Comparator<MOScope>

The MOScopeComparator compares two scopes 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(MOScope o1, MOScope 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(MOScope o1,
                   MOScope 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<MOScope>
Parameters:
o1 - a MOscope instance.
o2 - a MOscope 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<MOScope>
Overrides:
equals in class java.lang.Object

hashCode

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

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.