1 /* 2 * 01/07/2003 - 15:19:32 3 * 4 * IState.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 * <CODE>IState</CODE> is the epsilon enclosure of one or more <CODE>{@link IStatePro}</CODE>. 27 * The epsilon enclosure of an <CODE>IStatePro</CODE> are the <CODE>IStatePro</CODE> itself 28 * and all states that are reachable through epsilon transitions (see {@link IStatePro.addTransition}) 29 * beginning with that <CODE>IStatePro</CODE>. 30 * <BR>You can get an epsilon enclosure of an <CODE>IStatePro startState</CODE> manually by this code: 31 * <CODE> 32 * <BR> final IStatePro startState; 33 * <BR> final {@link StateProSet} epsilonClosure = new StateProSet(startState); 34 * <br> final {@link StateProSet.Iterator} it = states.iterator(); 35 * <br> for (IStatePro state=it.next(); state!=null; state=it.next()) { 36 * <br> IStatePro.ITransition[] transitions = state.getETransitions(); 37 * <br> for (int i=0; i transitions.length; ++i) { 38 * <br> epsilonClosure.add(transitions[i].getToState()); 39 * <br> } 40 * <BR> } 41 * </CODE> 42 * 43 * Description: 44 * Copyright: Copyright (c) 2001 45 * Company: 46 * @author 47 * @version 1.0 48 */ 49 50 public interface IState { 51 52 53 public boolean isFinal(); 54 55 /** 56 * returns the <CODE>IState</CODE> of all <CODE>IStatePro</CODE> that are reachable from 57 * this <CODE>IState</CODE> with a character <CODE>ch</CODE>. 58 * @param ch 59 * @return 60 */ 61 public IState next(char ch); 62 63 /** 64 * Returns all states that are reachable from this state through it's transitions and so on. 65 * <br>important: this state is only element of the returned set, if it is an element of a loop 66 * @return all reachable states as a set 67 */ 68 public StateProSet getAllReachableStates(); 69 // public StateProSet getNextStates(); 70 71 }