KickJava   Java API By Example, From Geeks To Geeks.

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


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: StateImpl.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.workflow.impl;
21
22 import org.apache.lenya.workflow.State;
23
24
25 /**
26  * Implementation of a state.
27  */

28 public class StateImpl implements State {
29     
30     /**
31      * Creates a new instance of StateImpl
32      * @param stateId The state ID.
33      */

34     protected StateImpl(String JavaDoc stateId) {
35         id = stateId;
36     }
37
38     private String JavaDoc id;
39
40     /**
41      * Returns the state ID.
42      * @return A string.
43      */

44     public String JavaDoc getId() {
45         return id;
46     }
47
48     /**
49      * @see java.lang.Object#toString()
50      */

51     public String JavaDoc toString() {
52         return getId();
53     }
54
55     /**
56      * @see java.lang.Object#equals(java.lang.Object)
57      */

58     public boolean equals(Object JavaDoc object) {
59         boolean result = false;
60
61         if (object instanceof StateImpl) {
62             result = getId().equals(((StateImpl) object).getId());
63         } else {
64             result = super.equals(object);
65         }
66
67         return result;
68     }
69
70     /**
71      * @see java.lang.Object#hashCode()
72      */

73     public int hashCode() {
74         return getId().hashCode();
75     }
76 }
77
Popular Tags