01: package org.drools.base;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: public final class DroolsQuery {
20: private final String name;
21: private final Object[] args;
22:
23: private static final Object[] EMPTY_PARAMS = new Object[0];
24:
25: public DroolsQuery(final String name) {
26: super ();
27: this .name = name;
28: this .args = EMPTY_PARAMS;
29: }
30:
31: public DroolsQuery(final String name, final Object[] params) {
32: super ();
33: this .name = name;
34: if (params != null) {
35: this .args = params;
36: } else {
37: this .args = EMPTY_PARAMS;
38: }
39: }
40:
41: public String getName() {
42: return this .name;
43: }
44:
45: public Object[] getArguments() {
46: return this .args;
47: }
48:
49: public int hashCode() {
50: final int PRIME = 31;
51: int result = 1;
52: result = PRIME * result
53: + ((this .name == null) ? 0 : this .name.hashCode());
54: return result;
55: }
56:
57: public boolean equals(final Object object) {
58: if (this == object) {
59: return true;
60: }
61:
62: if (object == null || getClass() != object.getClass()) {
63: return false;
64: }
65:
66: final DroolsQuery other = (DroolsQuery) object;
67: return this.name.equals(other.name);
68: }
69: }
|