home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / jmx.jar / javax / management / InQueryExp.class (.txt) < prev    next >
Encoding:
Java Class File  |  2002-10-28  |  2.2 KB  |  72 lines

  1. package javax.management;
  2.  
  3. class InQueryExp extends QueryEval implements QueryExp {
  4.    private static final long serialVersionUID = -5801329450358952434L;
  5.    private ValueExp val;
  6.    private ValueExp[] valueList;
  7.  
  8.    InQueryExp(ValueExp val, ValueExp[] valueList) {
  9.       this.val = val;
  10.       this.valueList = valueList;
  11.    }
  12.  
  13.    public void setMBeanServer(MBeanServer server) {
  14.       super.setMBeanServer(server);
  15.       if (this.val != null) {
  16.          this.val.setMBeanServer(server);
  17.       }
  18.  
  19.       if (this.valueList != null) {
  20.          for(int i = 0; i < this.valueList.length; ++i) {
  21.             ValueExp v = this.valueList[i];
  22.             if (v != null) {
  23.                v.setMBeanServer(server);
  24.             }
  25.          }
  26.       }
  27.  
  28.    }
  29.  
  30.    public boolean apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException {
  31.       if (this.val != null && this.valueList != null) {
  32.          ValueExp valueExp = this.val.apply(name);
  33.          if (valueExp instanceof NumericValueExp) {
  34.             NumericValueExp numExp = (NumericValueExp)valueExp;
  35.             if (numExp.isDouble()) {
  36.                for(int i = 0; i < this.valueList.length; ++i) {
  37.                   ValueExp exp = this.valueList[i];
  38.                   if (exp instanceof NumericValueExp && ((NumericValueExp)exp).doubleValue() == numExp.doubleValue()) {
  39.                      return true;
  40.                   }
  41.                }
  42.             } else {
  43.                for(int i = 0; i < this.valueList.length; ++i) {
  44.                   ValueExp exp = this.valueList[i];
  45.                   if (exp instanceof NumericValueExp && ((NumericValueExp)exp).longValue() == numExp.longValue()) {
  46.                      return true;
  47.                   }
  48.                }
  49.             }
  50.          } else if (valueExp instanceof StringValueExp) {
  51.             String s1 = ((StringValueExp)valueExp).getValue();
  52.  
  53.             for(int i = 0; i < this.valueList.length; ++i) {
  54.                ValueExp exp = this.valueList[i];
  55.                if (exp instanceof StringValueExp) {
  56.                   String s2 = ((StringValueExp)exp).getValue();
  57.                   if (s1 == null && s2 == null) {
  58.                      return true;
  59.                   }
  60.  
  61.                   if (s1 != null && s2 != null && s1.equals(s2)) {
  62.                      return true;
  63.                   }
  64.                }
  65.             }
  66.          }
  67.       }
  68.  
  69.       return false;
  70.    }
  71. }
  72.