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.incremental;
018
019import java.util.Collection;
020
021import net.automatalib.words.Alphabet;
022import net.automatalib.words.Word;
023
024/**
025 * Basic interface for incremental automata constructions. An incremental automaton construction
026 * creates an (acyclic) automaton by iterated insertion of example words.
027 *  
028 * @author Malte Isberner <malte.isberner@gmail.com>
029 *
030 * @param <A> the automaton model which is constructed
031 * @param <I> input symbol class
032 */
033public interface IncrementalConstruction<A, I> {
034        
035        /**
036         * Retrieves the input alphabet of this construction.
037         * @return the input alphabet
038         */
039        public Alphabet<I> getInputAlphabet();
040        
041        /**
042         * Checks the current state of the construction against a given target model,
043         * and returns a word exposing a difference if there is one.
044         * @param target the target automaton model
045         * @param inputs the set of input symbols to consider
046         * @param omitUndefined if this is set to <tt>true</tt>, then undefined transitions in
047         * the <tt>target</tt> model will be interpreted as "unspecified/don't know" and omitted
048         * in the equivalence test. Otherwise, they will be interpreted in the usual manner
049         * (e.g., non-accepting sink in case of DFAs).
050         * @return a separating word, or <tt>null</tt> if no difference could be found.
051         */
052        public Word<I> findSeparatingWord(A target, Collection<? extends I> inputs, boolean omitUndefined);
053        
054        /**
055         * Creates an automaton model from the current state of the construction.
056         * @return an automaton model
057         */
058        public A toAutomaton();
059        
060        /**
061         * Checks whether this class has definitive information about a given word.
062         * @param word the word
063         * @return <tt>true</tt> if this class has definitive information about the word,
064         * <tt>false</tt> otherwise. 
065         */
066        public boolean hasDefinitiveInformation(Word<I> word);
067}