KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > jrexx > set > FSAData


1 /*
2 * 01/07/2003 - 15:19:32
3 *
4 * Automaton.java -
5 * Copyright (C) 2003 Buero fuer Softwarearchitektur GbR
6 * ralf.meyer@karneim.com
7 * http://jrexx.sf.net
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */

23 package com.tc.jrexx.set;
24
25 /**
26  * FSAData is a simple representation of a finite state automaton as a ValueObject.
27  * It provides no functionality, but only the data of a specific automaton.
28  * It is used for the interchange of automatons between different applications or tools.
29  * In future there will be also an compatible XML representation.
30  * @author Ralf Meyer
31  */

32 public class FSAData implements java.io.Serializable JavaDoc {
33   static final long serialVersionUID = -8666364495865759270L;
34   static final int classVersion = 1;
35   int objectVersion = classVersion;
36
37
38   public static class State implements java.io.Serializable JavaDoc {
39     static final long serialVersionUID = -8580316209323007588L;
40     static final int classVersion = 1;
41     int objectVersion = classVersion;
42
43     public static class Transition implements java.io.Serializable JavaDoc {
44       static final long serialVersionUID = -7679256544857989306L;
45       static final int classVersion = 1;
46       int objectVersion = classVersion;
47
48       public com.tc.jrexx.automaton.IProperties properties;
49       public String JavaDoc charSet;
50       public int toStateNumber;
51
52       public Transition(
53           com.tc.jrexx.automaton.IProperties properties,
54         String JavaDoc charSet,
55         int toStateNumber
56       ) {
57         this.properties = properties;
58         this.charSet = charSet;
59         this.toStateNumber = toStateNumber;
60       }
61
62       public Transition(
63         String JavaDoc charSet,
64         int toStateNumber
65       ) {
66         this(null,charSet,toStateNumber);
67       }
68
69     }
70     public int number;
71     public boolean isFinal;
72     public Transition[] transitions;
73     public Boolean JavaDoc transitionsAreDeterministic;
74
75     public State(
76       int number,
77       boolean isFinal,
78       FSAData.State.Transition[] transitions,
79       boolean transitionsAreDeterministic
80     ) {
81       this.number = number;
82       this.isFinal = isFinal;
83       this.transitions = transitions;
84       this.transitionsAreDeterministic = new Boolean JavaDoc(transitionsAreDeterministic);
85     }
86
87
88     public State(
89       int number,
90       boolean isFinal,
91       FSAData.State.Transition[] transitions
92     ) {
93       this.number = number;
94       this.isFinal = isFinal;
95       this.transitions = transitions;
96       this.transitionsAreDeterministic = null;
97     }
98   }
99   public State[] states;
100   public Integer JavaDoc startStateNumber;
101   public Boolean JavaDoc isDeterministic;
102
103   public FSAData(
104     FSAData.State[] states,
105     Integer JavaDoc startStateNumber,
106     boolean isDeterministic
107   ) {
108     this.states = states;
109     this.startStateNumber = startStateNumber;
110     this.isDeterministic = new Boolean JavaDoc(isDeterministic);
111   }
112
113   public FSAData(
114     FSAData.State[] states,
115     Integer JavaDoc startStateNumber
116   ) {
117     this.states = states;
118     this.startStateNumber = startStateNumber;
119     this.isDeterministic = null;
120   }
121
122 }
123
Popular Tags