本文整理了Java中org.snmp4j.smi.OID.compareTo()
方法的一些代码示例,展示了OID.compareTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OID.compareTo()
方法的具体详情如下:
包路径:org.snmp4j.smi.OID
类名称:OID
方法名:compareTo
暂无
代码示例来源:origin: org.snmp4j/snmp4j
/**
* Returns the greater of the two OID values.
*
* @param a an OID.
* @param b an OID.
* @return {@code a} if a >= b, {@code b} otherwise.
* @since 1.7
*/
public static OID max(OID a, OID b) {
if (a.compareTo(b) >= 0) {
return a;
}
return b;
}
代码示例来源:origin: org.snmp4j/snmp4j
/**
* Returns the lesser of the two OID values.
*
* @param a an OID.
* @param b an OID.
* @return {@code a} if a <= b, {@code b} otherwise.
* @since 1.7
*/
public static OID min(OID a, OID b) {
if (a.compareTo(b) <= 0) {
return a;
}
return b;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
/**
* Returns the lesser of the two OID values.
* @param a
* an OID.
* @param b
* an OID.
* @return
* {@code a} if a <= b, {@code b} otherwise.
* @since 1.7
*/
public static OID min(OID a, OID b) {
if (a.compareTo(b) <= 0) {
return a;
}
return b;
}
代码示例来源:origin: org.kaazing/snmp4j
/**
* Returns the greater of the two OID values.
* @param a
* an OID.
* @param b
* an OID.
* @return
* <code>a</code> if a >= b, <code>b</code> otherwise.
* @since 1.7
*/
public static final OID max(OID a, OID b) {
if (a.compareTo(b) >= 0) {
return a;
}
return b;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
/**
* Returns the greater of the two OID values.
* @param a
* an OID.
* @param b
* an OID.
* @return
* {@code a} if a >= b, {@code b} otherwise.
* @since 1.7
*/
public static OID max(OID a, OID b) {
if (a.compareTo(b) >= 0) {
return a;
}
return b;
}
代码示例来源:origin: org.kaazing/snmp4j
/**
* Returns the lesser of the two OID values.
* @param a
* an OID.
* @param b
* an OID.
* @return
* <code>a</code> if a <= b, <code>b</code> otherwise.
* @since 1.7
*/
public static final OID min(OID a, OID b) {
if (a.compareTo(b) <= 0) {
return a;
}
return b;
}
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
/**
* Compare two BindEntries. Ordering is defined at oid-level.
*
* @param other
* The BindEntry to compare to.
* @return 0 on equals, 1 if this is bigger than other
*/
public int compareTo(Object other) {
if (other == null)
throw new NullPointerException("Can't compare to NULL");
if (!(other instanceof BindEntry))
throw new ClassCastException("Parameter is no BindEntry");
// trivial case
if (this.equals(other))
return 0;
BindEntry obe = (BindEntry) other;
// if (getOid().equals(obe.getOid()))
// return 0;
int res = oid.compareTo(obe.getOid());
return res;
}
代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core
/**
* Compare two BindEntries. Ordering is defined at oid-level.
*
* @param other
* The BindEntry to compare to.
* @return 0 on equals, 1 if this is bigger than other
*/
public int compareTo(Object other) {
if (other == null)
throw new NullPointerException("Can't compare to NULL");
if (!(other instanceof BindEntry))
throw new ClassCastException("Parameter is no BindEntry");
// trivial case
if (this.equals(other))
return 0;
BindEntry obe = (BindEntry) other;
// if (getOid().equals(obe.getOid()))
// return 0;
int res = oid.compareTo(obe.getOid());
return res;
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public synchronized void removeRows(OID lowerBoundIncl,
OID upperBoundExcl) {
Map<OID, R> m = (lowerBoundIncl == null) ? rows : rows.tailMap(lowerBoundIncl);
for (Iterator<Map.Entry<OID, R>> it = m.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<OID, R> item = it.next();
if ((upperBoundExcl == null) ||
(upperBoundExcl.compareTo(item.getKey()) > 0)) {
if (moTableModelListeners != null) {
MOTableModelEvent event =
new MOTableModelEvent(this, MOTableModelEvent.ROW_REMOVED,
item.getValue());
fireTableModelChanged(event);
}
it.remove();
}
else {
break;
}
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public synchronized void removeRows(OID lowerBoundIncl,
OID upperBoundExcl) {
Map m = (lowerBoundIncl == null) ? rows : rows.tailMap(lowerBoundIncl);
for (Iterator it = m.entrySet().iterator(); it.hasNext(); ) {
Map.Entry item = (Map.Entry) it.next();
if (upperBoundExcl == null ||
upperBoundExcl.compareTo(item.getKey()) > 0) {
if (moTableModelListeners != null) {
MOTableModelEvent event =
new MOTableModelEvent(this, MOTableModelEvent.ROW_REMOVED,
(MOTableRow)item.getValue());
fireTableModelChanged(event);
}
it.remove();
}
else {
break;
}
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
/**
* Compares this row with a {@link MOTableRow} instance
* by their index values.
* @param o
* a {@link MOTableRow} instance
* @return
* <code>getIndex().compareTo(o.getIndex())</code>
*/
public int compareTo(Object o) {
return getIndex().compareTo(((MOTableRow)o).getIndex());
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
@Override
public int compare(MOTableRow o1, MOTableRow o2) {
return o1.getIndex().compareTo(o2.getIndex());
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
/**
* Compares this row with a {@link MOTableRow} instance
* by their index values.
* @param o
* a {@link MOTableRow} instance
* @return
* <code>getIndex().compareTo(o.getIndex())</code>
*/
public int compareTo(Object o) {
return getIndex().compareTo(((MOTableRow)o).getIndex());
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public void substractScope(MOScope scope) {
if (lowerBound.compareTo(scope.getUpperBound()) <= 0) {
lowerBound = scope.getUpperBound();
lowerIncluded = !scope.isUpperIncluded();
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public void substractScope(MOScope scope) {
if (lowerBound.compareTo(scope.getUpperBound()) <= 0) {
lowerBound = scope.getUpperBound();
lowerIncluded = !scope.isUpperIncluded();
}
}
代码示例来源:origin: org.kaazing/snmp4j-agent
/**
* Checks if this scope is empty or not. An empty scope cannot cover any
* OID (i.e. lower bound is greater than upper bound).
* @return
* <code>true</code> if lower bound is greater than upper bound or if
* both bounds equal but one of the bounds is not-included.
*/
public boolean isEmpty() {
return (((lowerBound != null) && (upperBound != null)) &&
((lowerBound.compareTo(upperBound) > 0) ||
(lowerBound.equals(upperBound) &&
!(isLowerIncluded() && isUpperIncluded()))));
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
/**
* Checks if this scope is empty or not. An empty scope cannot cover any
* OID (i.e. lower bound is greater than upper bound).
* @return
* <code>true</code> if lower bound is greater than upper bound or if
* both bounds equal but one of the bounds is not-included.
*/
public boolean isEmpty() {
return (((lowerBound != null) && (upperBound != null)) &&
((lowerBound.compareTo(upperBound) > 0) ||
(lowerBound.equals(upperBound) &&
!(isLowerIncluded() && isUpperIncluded()))));
}
代码示例来源:origin: org.kaazing/snmp4j-agent
public boolean covers(OID oid) {
if (oid == null) {
return false;
}
return (((getLowerBound().compareTo(oid) < 0) ||
(isLowerIncluded() && getLowerBound().equals(oid))) &&
((getUpperBound() == null) ||
(getUpperBound().compareTo(oid) > 0) ||
(isUpperIncluded() && getUpperBound().equals(oid))));
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
public boolean covers(OID oid) {
if (oid == null) {
return false;
}
return (((getLowerBound().compareTo(oid) < 0) ||
(isLowerIncluded() && getLowerBound().equals(oid))) &&
((getUpperBound() == null) ||
(getUpperBound().compareTo(oid) > 0) ||
(isUpperIncluded() && getUpperBound().equals(oid))));
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
private static int compareQueryWithScope(MOScope scope, MOQuery scope2) {
int result = 0;
if (scope.getUpperBound() == null) {
return 1;
}
else {
result = scope.getUpperBound().compareTo(scope2.getLowerBound());
if (result == 0) {
if ((!scope.isUpperIncluded()) ||
(!scope2.isLowerIncluded())) {
return -1;
}
}
}
if (result == 0) {
if (scope instanceof MOContextScope) {
OctetString c1 = ((MOContextScope)scope).getContext();
OctetString c2 = scope2.getContext();
if ((c1 != null) && (c2 != null)) {
result = c1.compareTo(c2);
}
}
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!