KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jfun > yan > ReturnStateComponent


1 /*****************************************************************************
2  * Copyright (C) Codehaus.org. All rights reserved. *
3  * ------------------------------------------------------------------------- *
4  * The software in this package is published under the terms of the BSD *
5  * style license a copy of which has been included with this distribution in *
6  * the LICENSE.txt file. *
7  *****************************************************************************/

8 /*
9  * Created on Mar 21, 2005
10  *
11  * Author Ben Yu
12  * ZBS
13  */

14 package jfun.yan;
15
16 /**
17  * Codehaus.org.
18  *
19  * @author Ben Yu
20  *
21  */

22 final class ReturnStateComponent extends Component {
23   private final Stateful cc;
24   public boolean isConcrete(){
25     return false;
26   }
27   ReturnStateComponent(final Stateful cc) {
28     this.cc = cc;
29   }
30   public Class JavaDoc verify(Dependency pp){
31     return Object JavaDoc.class;
32   }
33   public Object JavaDoc create(Dependency pp){
34     return cc.getState();
35   }
36   public Class JavaDoc getType(){
37     return Object JavaDoc.class;
38   }
39   public String JavaDoc toString(){
40     return "returnState <" + cc +">";
41   }
42
43   public boolean equals(Object JavaDoc obj) {
44     if(obj instanceof ReturnStateComponent){
45       final ReturnStateComponent rsc2 = (ReturnStateComponent)obj;
46       return cc.equals(rsc2.cc);
47     }
48     else return false;
49   }
50   public int hashCode() {
51     return cc.hashCode()+1;
52   }
53   public boolean isSingleton(){
54     return false;
55   }
56 }
57
Popular Tags