KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Util > DFSRChecker > state > IndexState


1 /*
2  * $Id: IndexState.java,v 1.4 2005/07/08 12:04:12 kofron Exp $
3  *
4  * Copyright 2004
5  * Distributed Systems Research Group
6  * Department of Software Engineering
7  * Faculty of Mathematics and Physics
8  * Charles University, Prague
9  *
10  * Copyright 2005
11  * Formal Methods In Software Engineering Group
12  * Institute of Computer Science
13  * Academy of Sciences of the Czech Republic
14  *
15  * This code was developed by Jan Kofron <kofron@nenya.ms.mff.cuni.cz>
16  */

17
18
19 package SOFA.SOFAnode.Util.DFSRChecker.state;
20
21 /**
22  * This class represents the state with an index of the subautomaton and pointer
23  * to it. Note that both the index and the pointer are neccessary. The members
24  * of this class are declared as public for better performance of the
25  * SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.
26  */

27 public class IndexState extends State {
28
29     /** Creates a new instance of IndexState */
30     public IndexState(int index, State[] states) {
31         this.index = index;
32         this.states = states;
33     }
34
35     /**
36      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.state.State#equals(SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.state.State)
37      */

38     public boolean equals(State another) {
39         if (!(another instanceof IndexState))
40             return false;
41
42         IndexState istate = (IndexState) another;
43
44         if (this.index != istate.index)
45             return false;
46
47         if (this.signature == null)
48             this.getSignature();
49
50         if (another.signature == null)
51             another.getSignature();
52
53         return this.getSignature().equals(istate.getSignature());
54     }
55     
56     /**
57      * @see SOFA.SOFAnode.Util.objectweb.fractal.behprotocols.checker.state.State#createSignature()
58      */

59     protected void createSignature() {
60         for (int i = 0; i < states.length; ++i) {
61             this.signature.concat(states[i].getSignature());
62         }
63     }
64     
65
66     /**
67      * The substates.
68      */

69     final public State[] states;
70
71     /**
72      * the index of the automaton
73      */

74     final public int index;
75
76
77 }
Popular Tags