001/* Copyright (C) 2013 TU Dortmund 002 * This file is part of LearnLib, http://www.learnlib.de/. 003 * 004 * LearnLib 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 * LearnLib 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 LearnLib; if not, see 015 * <http://www.gnu.de/documents/lgpl.en.html>. 016 */ 017package de.learnlib.algorithms.lstargeneric.mealy; 018 019import net.automatalib.words.Alphabet; 020import net.automatalib.words.Word; 021 022import java.util.ArrayList; 023import java.util.List; 024 025public class LStarMealyUtil { 026 027 public static <I> List<Word<I>> ensureSuffixCompliancy(List<Word<I>> suffixes, Alphabet<I> alphabet, 028 boolean needsConsistencyCheck) { 029 List<Word<I>> compSuffixes = new ArrayList<Word<I>>(); 030 if(needsConsistencyCheck) { 031 for(int i = 0; i < alphabet.size(); i++) 032 compSuffixes.add(Word.fromLetter(alphabet.getSymbol(i))); 033 } 034 035 for(Word<I> w : suffixes) { 036 if(w.isEmpty()) 037 continue; 038 if(needsConsistencyCheck && w.length() == 1) 039 continue; 040 compSuffixes.add(w); 041 } 042 043 return compSuffixes; 044 } 045 046}