/* * 01/07/2003 - 15:19:32 * * IState.java - * Copyright (C) 2003 Buero fuer Softwarearchitektur GbR * ralf.meyer@karneim.com * http://jrexx.sf.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ package com.karneim.util.collection.set; /** * IState is the epsilon enclosure of one or more {@link IStatePro}. * The epsilon enclosure of an IStatePro are the IStatePro itself * and all states that are reachable through epsilon transitions (see {@link IStatePro.addTransition}) * beginning with that IStatePro. *
You can get an epsilon enclosure of an IStatePro startState manually by this code: * *
final IStatePro startState; *
final {@link StateProSet} epsilonClosure = new StateProSet(startState); *
final {@link StateProSet.Iterator} it = states.iterator(); *
for (IStatePro state=it.next(); state!=null; state=it.next()) { *
IStatePro.ITransition[] transitions = state.getETransitions(); *
for (int i=0; i transitions.length; ++i) { *
epsilonClosure.add(transitions[i].getToState()); *
} *
} *
* * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public interface IState { public boolean isFinal(); /** * returns the IState of all IStatePro that are reachable from * this IState with a character ch. * @param ch * @return */ public IState next(char ch); /** * Returns all states that are reachable from this state through it's transitions and so on. *
important: this state is only element of the returned set, if it is an element of a loop * @return all reachable states as a set */ public StateProSet getAllReachableStates(); // public StateProSet getNextStates(); }