01: /* JFox, the OpenSource J2EE Application Server
02: *
03: * Copyright (C) 2002 huihoo.com
04: * Distributable under GNU LGPL license
05: * See the GNU Lesser General Public License for more details.
06: */
07:
08: package org.huihoo.jfox.jmx.queries;
09:
10: import javax.management.QueryEval;
11: import javax.management.QueryExp;
12: import javax.management.ObjectName;
13: import javax.management.BadStringOperationException;
14: import javax.management.BadBinaryOpValueExpException;
15: import javax.management.BadAttributeValueExpException;
16: import javax.management.InvalidApplicationException;
17:
18: /**
19: *
20: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
21: */
22:
23: public class AndQueryExp extends QueryEval implements QueryExp {
24:
25: private QueryExp leftExp;
26: private QueryExp rightExp;
27:
28: public AndQueryExp() {
29:
30: }
31:
32: public AndQueryExp(QueryExp _leftExp, QueryExp _rightExp) {
33: leftExp = _leftExp;
34: rightExp = _rightExp;
35: }
36:
37: public QueryExp getLeftExp() {
38: return leftExp;
39: }
40:
41: public QueryExp getRightExp() {
42: return rightExp;
43: }
44:
45: public boolean apply(ObjectName objectname)
46: throws BadStringOperationException,
47: BadBinaryOpValueExpException,
48: BadAttributeValueExpException, InvalidApplicationException {
49: return leftExp.apply(objectname) && rightExp.apply(objectname);
50: }
51:
52: public String toString() {
53: return "(" + leftExp + ") and (" + rightExp + ")";
54: }
55: }
|