java.lang.Object
org.snmp4j.agent.DefaultMOScope
org.snmp4j.agent.DefaultMOContextScope
- All Implemented Interfaces:
MOContextScope,MOScope,MutableMOScope
The
DefaultMOContextScope is the default implementation of
a MOContextScope representing an OID scope that distinguishes between
different contexts.- Version:
- 1.1
- Author:
- Frank Fock
-
Field Summary
Fields inherited from class org.snmp4j.agent.DefaultMOScope
lowerBound, lowerIncluded, upperBound, upperIncluded -
Constructor Summary
ConstructorsConstructorDescriptionCreates a context scope from another context scope.DefaultMOContextScope(org.snmp4j.smi.OctetString context, MOScope extendedScope) Creates a context scope from a plain OID scope.DefaultMOContextScope(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID lowerBound, boolean lowerIncluded, org.snmp4j.smi.OID upperBound, boolean upperIncluded) Creates a context scope from a context, upper, and lower bound OID. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether an object is equal to this one.org.snmp4j.smi.OctetStringGets the context of the scope.inthashCode()static booleanisContextMatching(MOScope a, MOScope b) Indicates whether the given scopes have a matching context.booleanChecks whether the supplied scope is covered by this scope.booleanisOverlapping(MOScope other) Checks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.voidsetContext(org.snmp4j.smi.OctetString context) Sets the context name for this scope.toString()Methods inherited from class org.snmp4j.agent.DefaultMOScope
covers, covers, covers, getLowerBound, getUpperBound, isEmpty, isLowerIncluded, isUpperIncluded, overlaps, setLowerBound, setLowerIncluded, setUpperBound, setUpperIncluded, subtractScopeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.snmp4j.agent.MOScope
covers, getLowerBound, getUpperBound, isLowerIncluded, isUpperIncluded
-
Constructor Details
-
DefaultMOContextScope
public DefaultMOContextScope(org.snmp4j.smi.OctetString context, org.snmp4j.smi.OID lowerBound, boolean lowerIncluded, org.snmp4j.smi.OID upperBound, boolean upperIncluded) Creates a context scope from a context, upper, and lower bound OID.- Parameters:
context- the context for which this scope is valid.lowerBound- the lower bound of the OID scope (must not benull).lowerIncluded- specifies whether the lower bound is included or not.upperBound- the upper bound of the OID scope (nullfor no upper limit).upperIncluded- specifies whether the upper bound is included or not.
-
DefaultMOContextScope
Creates a context scope from another context scope.- Parameters:
scope- a MOContextScope instance whose context and bounds are copied by reference.
-
DefaultMOContextScope
Creates a context scope from a plain OID scope.- Parameters:
context- the context name for the new context scope.extendedScope- the OID scope that defines the OID range of the new scope (boundaries are copied by reference).
-
-
Method Details
-
getContext
public org.snmp4j.smi.OctetString getContext()Gets the context of the scope.- Specified by:
getContextin interfaceMOContextScope- Returns:
- the context name this scope applies to.
-
setContext
public void setContext(org.snmp4j.smi.OctetString context) Sets the context name for this scope.- Parameters:
context- a context name.
-
equals
Indicates whether an object is equal to this one.- Overrides:
equalsin classDefaultMOScope- Parameters:
obj- some object.- Returns:
trueonly ifobjis aMOContextScopeand if context and scope equals this one's.
-
hashCode
public int hashCode()- Overrides:
hashCodein classDefaultMOScope
-
isContextMatching
Indicates whether the given scopes have a matching context. The context does not match if both areMOContextScopeinstances and both contexts are notnulland different.- Parameters:
a- a MOScope instance.b- another MOScope instance.- Returns:
trueif both scopes have matching contexts (or at least one has no context defined).- Since:
- 1.1
-
isCovered
Description copied from interface:MOScopeChecks whether the supplied scope is covered by this scope.- Specified by:
isCoveredin interfaceMOScope- Overrides:
isCoveredin classDefaultMOScope- Parameters:
other- theMOScopeto check- Returns:
trueif the lower bound ofotheris greater or equal than the lower bound of this scope and if the upper bound ofotheris lower or equal than the upper bound of this scope.
-
toString
- Overrides:
toStringin classDefaultMOScope
-
isOverlapping
Description copied from interface:MOScopeChecks whether the supplied scope overlap with this one, thus sharing at least one OID with the supplied one.- Specified by:
isOverlappingin interfaceMOScope- Overrides:
isOverlappingin classDefaultMOScope- Parameters:
other- aMOScope.- Returns:
trueif there exists at least one OID that is included in both scopes.
-