All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.automatalib.automata.transout.abstractimpl.AbstractTransOutAutomaton Maven / Gradle / Ivy

/* Copyright (C) 2013 TU Dortmund
 * This file is part of AutomataLib, http://www.automatalib.net/.
 * 
 * AutomataLib is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 3.0 as published by the Free Software Foundation.
 * 
 * AutomataLib 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 AutomataLib; if not, see
 * http://www.gnu.de/documents/lgpl.en.html.
 */
package net.automatalib.automata.transout.abstractimpl;

import java.util.Collection;
import java.util.List;

import net.automatalib.automata.transout.TransitionOutputAutomaton;
import net.automatalib.ts.abstractimpl.AbstractDeterministicTransOutTS;
import net.automatalib.words.Word;
import net.automatalib.words.WordBuilder;


public abstract class AbstractTransOutAutomaton {
	
	public static  Word computeOutput(TransitionOutputAutomaton $this,
			Iterable input) {
		WordBuilder result;
		if(input instanceof Collection)
			result = new WordBuilder(((Collection)input).size());
		else
			result = new WordBuilder<>();
		$this.trace(input, result);
		return result.toWord();
	}
	
	public static  Word computeSuffixOutput(TransitionOutputAutomaton $this,
			Iterable prefix, Iterable suffix) {
		WordBuilder result;
		if(suffix instanceof Collection)
			result = new WordBuilder(((Collection)suffix).size());
		else
			result = new WordBuilder<>();
		S state = $this.getState(prefix);
		$this.trace(state, suffix, result);
		return result.toWord();
	}
	
	
	@Deprecated
	public static  boolean trace(TransitionOutputAutomaton $this,
			Iterable input, List output) {
		return AbstractDeterministicTransOutTS.trace($this, input, output);
	}
	
	@Deprecated
	public static  boolean trace(TransitionOutputAutomaton $this,
			S state, Iterable input, List output) {
		return AbstractDeterministicTransOutTS.trace($this, state, input, output);
	}
	
	@Deprecated
	public static  O getOutput(TransitionOutputAutomaton $this,
			S state, I input) {
		return AbstractDeterministicTransOutTS.getOutput($this, state, input);
	}
}