01: /*
02: * Copyright 2006 JBoss Inc
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.drools.lang.descr;
18:
19: /**
20: * @author etirelli
21: *
22: */
23: public class ImportDescr extends BaseDescr {
24:
25: private static final long serialVersionUID = 400L;
26: private String target;
27:
28: public ImportDescr() {
29: }
30:
31: public ImportDescr(final String clazzName) {
32: this .target = clazzName;
33: }
34:
35: public String getTarget() {
36: return this .target;
37: }
38:
39: public void setTarget(final String clazzName) {
40: this .target = clazzName;
41: }
42:
43: /* (non-Javadoc)
44: * @see java.lang.Object#hashCode()
45: */
46: public int hashCode() {
47: final int PRIME = 31;
48: int result = 1;
49: result = PRIME * result
50: + ((this .target == null) ? 0 : this .target.hashCode());
51: result = PRIME * result + this .getStartCharacter();
52: return result;
53: }
54:
55: /* (non-Javadoc)
56: * @see java.lang.Object#equals(java.lang.Object)
57: */
58: public boolean equals(final Object obj) {
59: if (this == obj) {
60: return true;
61: }
62: if (obj == null) {
63: return false;
64: }
65: if (getClass() != obj.getClass()) {
66: return false;
67: }
68: final ImportDescr other = (ImportDescr) obj;
69: if (this .target == null) {
70: if (other.target != null) {
71: return false;
72: }
73: } else if (!this .target.equals(other.target)) {
74: return false;
75: }
76: return this .getStartCharacter() == other.getStartCharacter();
77: }
78:
79: public String toString() {
80: return "import " + this.target;
81: }
82:
83: }
|