001: /*
002: * 01/07/2003 - 15:19:32
003: *
004: * Automaton.java -
005: * Copyright (C) 2003 Buero fuer Softwarearchitektur GbR
006: * ralf.meyer@karneim.com
007: * http://jrexx.sf.net
008: *
009: * This program is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public License
011: * as published by the Free Software Foundation; either version 2
012: * of the License, or (at your option) any later version.
013: *
014: * This program is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
017: * GNU Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public License
020: * along with this program; if not, write to the Free Software
021: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
022: */
023: package com.tc.jrexx.set;
024:
025: /**
026: * FSAData is a simple representation of a finite state automaton as a ValueObject.
027: * It provides no functionality, but only the data of a specific automaton.
028: * It is used for the interchange of automatons between different applications or tools.
029: * In future there will be also an compatible XML representation.
030: * @author Ralf Meyer
031: */
032: public class FSAData implements java.io.Serializable {
033: static final long serialVersionUID = -8666364495865759270L;
034: static final int classVersion = 1;
035: int objectVersion = classVersion;
036:
037: public static class State implements java.io.Serializable {
038: static final long serialVersionUID = -8580316209323007588L;
039: static final int classVersion = 1;
040: int objectVersion = classVersion;
041:
042: public static class Transition implements java.io.Serializable {
043: static final long serialVersionUID = -7679256544857989306L;
044: static final int classVersion = 1;
045: int objectVersion = classVersion;
046:
047: public com.tc.jrexx.automaton.IProperties properties;
048: public String charSet;
049: public int toStateNumber;
050:
051: public Transition(
052: com.tc.jrexx.automaton.IProperties properties,
053: String charSet, int toStateNumber) {
054: this .properties = properties;
055: this .charSet = charSet;
056: this .toStateNumber = toStateNumber;
057: }
058:
059: public Transition(String charSet, int toStateNumber) {
060: this (null, charSet, toStateNumber);
061: }
062:
063: }
064:
065: public int number;
066: public boolean isFinal;
067: public Transition[] transitions;
068: public Boolean transitionsAreDeterministic;
069:
070: public State(int number, boolean isFinal,
071: FSAData.State.Transition[] transitions,
072: boolean transitionsAreDeterministic) {
073: this .number = number;
074: this .isFinal = isFinal;
075: this .transitions = transitions;
076: this .transitionsAreDeterministic = new Boolean(
077: transitionsAreDeterministic);
078: }
079:
080: public State(int number, boolean isFinal,
081: FSAData.State.Transition[] transitions) {
082: this .number = number;
083: this .isFinal = isFinal;
084: this .transitions = transitions;
085: this .transitionsAreDeterministic = null;
086: }
087: }
088:
089: public State[] states;
090: public Integer startStateNumber;
091: public Boolean isDeterministic;
092:
093: public FSAData(FSAData.State[] states, Integer startStateNumber,
094: boolean isDeterministic) {
095: this .states = states;
096: this .startStateNumber = startStateNumber;
097: this .isDeterministic = new Boolean(isDeterministic);
098: }
099:
100: public FSAData(FSAData.State[] states, Integer startStateNumber) {
101: this.states = states;
102: this.startStateNumber = startStateNumber;
103: this.isDeterministic = null;
104: }
105:
106: }
|