KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > workflow > impl > EventImpl


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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
18 /* $Id: EventImpl.java 42837 2004-04-13 22:04:35Z joerg $ */
19
20 package org.apache.lenya.workflow.impl;
21
22 import org.apache.lenya.workflow.Event;
23
24
25 /**
26  * Implementation of an event.
27  */

28 public class EventImpl implements Event {
29     
30     /**
31      * Creates a new instance of EventImpl
32      * @param eventName The event name.
33      */

34     protected EventImpl(String JavaDoc eventName) {
35         name = eventName;
36     }
37
38     private String JavaDoc name;
39
40     /**
41      * Returns a string expression of this object.
42      * @return A string.
43      */

44     public String JavaDoc toString() {
45         return getName();
46     }
47
48     /* (non-Javadoc)
49      * @see java.lang.Object#equals(java.lang.Object)
50      */

51     public boolean equals(Object JavaDoc otherObject) {
52         boolean equals = false;
53
54         if (otherObject instanceof EventImpl) {
55             EventImpl otherEvent = (EventImpl) otherObject;
56             equals = getName().equals(otherEvent.getName());
57         } else {
58             equals = super.equals(otherObject);
59         }
60
61         return equals;
62     }
63
64     /* (non-Javadoc)
65      * @see java.lang.Object#hashCode()
66      */

67     public int hashCode() {
68         return getName().hashCode();
69     }
70
71     /**
72      * @see org.apache.lenya.workflow.Event#getName()
73      */

74     public String JavaDoc getName() {
75         return name;
76     }
77 }
78
Popular Tags