001/* Copyright (C) 2013 TU Dortmund
002 * This file is part of AutomataLib, http://www.automatalib.net/.
003 * 
004 * AutomataLib is free software; you can redistribute it and/or
005 * modify it under the terms of the GNU Lesser General Public
006 * License version 3.0 as published by the Free Software Foundation.
007 * 
008 * AutomataLib is distributed in the hope that it will be useful,
009 * but WITHOUT ANY WARRANTY; without even the implied warranty of
010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
011 * Lesser General Public License for more details.
012 * 
013 * You should have received a copy of the GNU Lesser General Public
014 * License along with AutomataLib; if not, see
015 * http://www.gnu.de/documents/lgpl.en.html.
016 */
017package net.automatalib.automata;
018
019import java.util.Collection;
020
021/**
022 * A mutable automaton. This interface adds support for non-destructive modifications, i.e.,
023 * adding and modifying states and transitions. If also removal of states and single transitions
024 * (from the set of outgoing transitions) should be removed, then {@link ShrinkableAutomaton}
025 * is the adequate interface.
026 * 
027 * @author Malte Isberner <malte.isberner@gmail.com>
028 *
029 * @param <S> state class.
030 * @param <I> input symbol class.
031 * @param <T> transition class.
032 * @param <SP> state property.
033 * @param <TP> transition property.
034 */
035public abstract interface MutableAutomaton<S,I,T,SP,TP> 
036        extends UniversalAutomaton<S, I, T, SP, TP> {
037
038        /**
039         * Removes all states and transitions.
040         */
041        public void clear();
042        
043        /**
044         * Adds a state to the automaton.
045         * @param property
046         * @return
047         */
048        public S addState(SP property);
049        public S addInitialState(SP property);
050        
051        public S addState();
052        public S addInitialState();
053
054    public void setInitial(S state, boolean initial);
055        
056        public void setStateProperty(S state, SP property);
057        public void setTransitionProperty(T transition, TP property);
058    
059    public T createTransition(S successor, TP properties);
060    
061    public void addTransition(S state, I input, T transition);
062    public void addTransitions(S state, I input, Collection<? extends T> transitions);
063    public void setTransitions(S state, I input, Collection<? extends T> transitions);
064    public void removeTransition(S state, I input, T transition);
065    public void removeAllTransitions(S state, I input);
066    public void removeAllTransitions(S state);
067    
068    public T addTransition(S state, I input, S successor, TP properties);
069    
070    public T copyTransition(T trans, S succ);
071}