01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package javax.management;
23:
24: /**
25: * A NOT Query Expression.<p>
26: *
27: * Returns true when either expression is false.
28: *
29: * <p><b>Revisions:</b>
30: * <p><b>20020314 Adrian Brock:</b>
31: * <ul>
32: * <li>Fix the human readable expression
33: * </ul>
34: * <p><b>20020317 Adrian Brock:</b>
35: * <ul>
36: * <li>Make queries thread safe
37: * </ul>
38: *
39: * @author <a href="mailto:Adrian.Brock@HappeningTimes.com">Adrian Brock</a>.
40: * @version $Revision: 57200 $
41: */
42: class NotQueryExp extends QueryEval implements QueryExp {
43: // Constants ---------------------------------------------------
44:
45: private static final long serialVersionUID = 5269643775896723397L;
46:
47: // Attributes --------------------------------------------------
48:
49: /**
50: * The query expression to negate
51: */
52: private QueryExp exp;
53:
54: // Static ------------------------------------------------------
55:
56: // Constructors ------------------------------------------------
57:
58: public NotQueryExp() {
59: }
60:
61: /**
62: * Create a new NOT query Expression
63: *
64: * @param expression the query expression to negate
65: */
66: public NotQueryExp(QueryExp expression) {
67: this .exp = expression;
68: }
69:
70: // Public ------------------------------------------------------
71:
72: // QueryExp implementation -------------------------------------
73:
74: public boolean apply(ObjectName name)
75: throws BadStringOperationException,
76: BadBinaryOpValueExpException,
77: BadAttributeValueExpException, InvalidApplicationException {
78: return !exp.apply(name);
79: }
80:
81: // Object overrides --------------------------------------------
82:
83: public String toString() {
84: return new String("!(" + exp.toString() + ")");
85: }
86:
87: // Protected ---------------------------------------------------
88:
89: // Private -----------------------------------------------------
90:
91: // Inner classes -----------------------------------------------
92: }
|