⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultmoquery.java

📁 你个snmp的源码
💻 JAVA
字号:
/*_############################################################################
  _##
  _##  SNMP4J-Agent - DefaultMOQuery.java
  _##
  _##  Copyright 2005-2006  Frank Fock (SNMP4J.org)
  _##
  _##  Licensed under the Apache License, Version 2.0 (the "License");
  _##  you may not use this file except in compliance with the License.
  _##  You may obtain a copy of the License at
  _##
  _##      http://www.apache.org/licenses/LICENSE-2.0
  _##
  _##  Unless required by applicable law or agreed to in writing, software
  _##  distributed under the License is distributed on an "AS IS" BASIS,
  _##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  _##  See the License for the specific language governing permissions and
  _##  limitations under the License.
  _##
  _##########################################################################*/


package org.snmp4j.agent;

/**
 * The <code>DefaultMOQuery</code> class is the default implementation of a
 * managed object query. It is used to lookup managed objects, for example in
 * a {@link MOServer} repository.
 *
 * @author Frank Fock
 * @version 1.0
 */
public class DefaultMOQuery implements MOQuery {

  private MOContextScope scope;

  /**
   * Creates a context aware query from a context aware OID scope.
   * @param scope
   *    a scope that defines the possible result set of OIDs from a specific
   *    context for this query.
   */
  public DefaultMOQuery(MOContextScope scope) {
    this.scope = scope;
  }

  /**
   * Gets the search range of this query.
   *
   * @return a <code>MORange</code> instance denoting upper and lower bound of
   *   this queries scope.
   */
  public MOContextScope getScope() {
    return scope;
  }

  /**
   * Checks whether a managed object matches the internal query criteria
   * defined by this query.
   *
   * @param managedObject the <code>ManagedObject</code> instance to check.
   * @return <code>true</code> if the <code>managedObject</code> matches the
   *   query.
   */
  public boolean matchesQuery(ManagedObject managedObject) {
    return true;
  }

  public void substractScope(MOScope scope) {
    if (this.scope instanceof MutableMOScope) {
      ((MutableMOScope)this.scope).substractScope(scope);
    }
    else {
      throw new UnsupportedOperationException();
    }
  }

  public String toString() {
    return getClass().getName()+"["+getScope().getContext()+"]="+
        getScope().getLowerBound()+"<"+
        (getScope().isLowerIncluded() ? "=" : "")+" x <"+
        (getScope().isUpperIncluded() ? "=" : "")+
        getScope().getUpperBound();
  }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -