public class DefaultMOScope extends Object implements MOScope, MutableMOScope
| Modifier and Type | Field and Description |
|---|---|
protected org.snmp4j.smi.OID |
lowerBound |
protected boolean |
lowerIncluded |
protected org.snmp4j.smi.OID |
upperBound |
protected boolean |
upperIncluded |
| Constructor and Description |
|---|
DefaultMOScope(MOScope other)
Creates a scope from another scope by referencing its bound values.
|
DefaultMOScope(org.snmp4j.smi.OID lowerBound,
boolean lowerIncluded,
org.snmp4j.smi.OID upperBound,
boolean upperIncluded)
Creates an OID scope from lower and upper bound.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
covers(MOScope covered)
Indicates whether this scope covers by the supplied one, that is whether
the lower bound of this scope is less or equal to the lower bound of the
covered scope and if the upper bound is greater or equal to the upper
bound of the covered scope.
|
static boolean |
covers(MOScope scope,
MOScope covered)
Indicates whether the first supplied scope covers by second one.
|
boolean |
covers(org.snmp4j.smi.OID oid)
Checks if this scope covers the supplied OID.
|
boolean |
equals(Object obj) |
org.snmp4j.smi.OID |
getLowerBound()
Gets the lower bound OID of the scope.
|
org.snmp4j.smi.OID |
getUpperBound()
Gets the upper bound OID of the scope.
|
int |
hashCode() |
boolean |
isCovered(MOScope other)
Checks whether the supplied scope is covered by this scope.
|
boolean |
isEmpty()
Checks if this scope is empty or not.
|
boolean |
isLowerIncluded()
Indicates whether the lower bound OID is included in the scope or not.
|
boolean |
isOverlapping(MOScope other)
Checks whether the supplied scope overlap with this one, thus sharing at
least one OID with the supplied one.
|
boolean |
isUpperIncluded()
Indicates whether the upper bound OID is included in the scope or not.
|
static boolean |
overlaps(MOScope scope,
MOScope intersected)
Indicates whether the first scope supplied overlaps with the second one.
|
void |
setLowerBound(org.snmp4j.smi.OID lowerBound)
Sets the lower bound OID of the scope.
|
void |
setLowerIncluded(boolean lowerIncluded)
Sets the flag specifying whether the lower bound OID is included in the
scope or not.
|
void |
setUpperBound(org.snmp4j.smi.OID upperBound)
Sets the upper bound OID of the scope (can be
null for an
unbounded scope. |
void |
setUpperIncluded(boolean upperIncluded)
Sets the flag specifying whether the upper bound OID is included in the
scope or not.
|
void |
substractScope(MOScope scope)
Changes the scope to no longer cover any elements in covered by the
specified scope.
|
String |
toString() |
protected org.snmp4j.smi.OID lowerBound
protected org.snmp4j.smi.OID upperBound
protected boolean lowerIncluded
protected boolean upperIncluded
public DefaultMOScope(org.snmp4j.smi.OID lowerBound,
boolean lowerIncluded,
org.snmp4j.smi.OID upperBound,
boolean upperIncluded)
lowerBound - the lower bound of the scope.lowerIncluded - indicates whether the lower bound is included in the scope or not.upperBound - the upper bound of the scope, null can be specified to
set no upper limit.upperIncluded - indicates whether the upper bound is included in the scope or not.public DefaultMOScope(MOScope other)
other - another scope.public org.snmp4j.smi.OID getLowerBound()
MOScopeMOScope.isLowerIncluded().getLowerBound in interface MOScopepublic org.snmp4j.smi.OID getUpperBound()
MOScopeMOScope.isUpperIncluded().getUpperBound in interface MOScopepublic boolean isLowerIncluded()
MOScopeisLowerIncluded in interface MOScopetrue if the lower bound is included.public boolean isUpperIncluded()
MOScopeisUpperIncluded in interface MOScopetrue if the upper bound is included.public boolean isCovered(MOScope other)
MOScopepublic boolean isOverlapping(MOScope other)
MOScopeisOverlapping in interface MOScopeother - a MOScope.true if there exists at least one OID that is included in
both scopes.public void setLowerBound(org.snmp4j.smi.OID lowerBound)
MutableMOScopesetLowerBound in interface MutableMOScopelowerBound - an OID.public void setLowerIncluded(boolean lowerIncluded)
MutableMOScopesetLowerIncluded in interface MutableMOScopelowerIncluded - true if the lower bound is included, false
otherwise.public void setUpperBound(org.snmp4j.smi.OID upperBound)
MutableMOScopenull for an
unbounded scope.setUpperBound in interface MutableMOScopeupperBound - an OID or null.public void setUpperIncluded(boolean upperIncluded)
MutableMOScopeupperBound is
null.setUpperIncluded in interface MutableMOScopeupperIncluded - true if the upper bound is included, false
otherwise.public boolean covers(MOScope covered)
covered - a MOScope instance.true if this OID scope covers the supplied one.public static boolean covers(MOScope scope, MOScope covered)
scope - the covering scope.covered - the covered scope.true if the lower bound of scope is less or
equal to the lower bound of covered and if the upper bound
is greater or equal to the upper bound of covered.public static boolean overlaps(MOScope scope, MOScope intersected)
scope - a MOScope instance.intersected - the presumable intersected MOScope.true if scope overlaps any bound of
intersected. This is always the case, if the upper bound
of both scopes is null.public void substractScope(MOScope scope)
MutableMOScopesubstractScope in interface MutableMOScopescope - a MOScope instance that defines the range of OIDs
that should be no longer in this scope.public boolean covers(org.snmp4j.smi.OID oid)
MOScopepublic boolean isEmpty()
true if lower bound is greater than upper bound or if
both bounds equal but one of the bounds is not-included.Copyright © 2020 SNMP4J.org. All rights reserved.