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

net.automatalib.automata.fsa.abstractimpl.AbstractMutableFSA 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.fsa.abstractimpl;

import net.automatalib.automata.abstractimpl.AbstractMutableAutomaton;
import net.automatalib.automata.fsa.MutableFSA;

public abstract class AbstractMutableFSA extends
		AbstractMutableAutomaton implements
		MutableFSA {
	

	public static  void setStateProperty(MutableFSA $this, S state,
			Boolean property) {
		boolean acc = (property != null) ? property.booleanValue() : false;
		$this.setAccepting(state, acc);
	}

	public static  void setTransitionProperty(MutableFSA $this,
			S transition, Void property) {
	}

	public static  void flipAcceptance(MutableFSA $this) {
		for (S state : $this)
			$this.setAccepting(state, !$this.isAccepting(state));
	}
	
	public static  S addState(MutableFSA $this) {
		return $this.addState(false);
	}
	
	public static  S addState(MutableFSA $this, Boolean property) {
		boolean acc = (property != null) ? property.booleanValue() : false;
		return $this.addState(acc);
	}
	
	public static  S addInitialState(MutableFSA $this) {
		return $this.addInitialState(false);
	}
	
	public static  S addInitialState(MutableFSA $this, Boolean property) {
		boolean acc = (property != null) ? property.booleanValue() : false;
		return $this.addInitialState(acc);
	}
	

	public static  S createTransition(MutableFSA $this, S successor, Void properties) {
		return successor;
	}

	public static  S copyTransition(MutableFSA $this, S trans, S succ) {
		return succ;
	}
	
	
	public static  S addInitialState(MutableFSA $this, boolean accepting) {
		S init = $this.addState(accepting);
		$this.setInitial(init, true);
		return init;
	}

	
	/*
	 * (non-Javadoc)
	 * @see net.automatalib.automata.MutableAutomaton#setStateProperty(java.lang.Object, java.lang.Object)
	 */
	@Override
	public void setStateProperty(S state, Boolean property) {
		setStateProperty(this, state, property);
	}
	
	/*
	 * (non-Javadoc)
	 * @see net.automatalib.automata.MutableAutomaton#setTransitionProperty(java.lang.Object, java.lang.Object)
	 */
	@Override
	public void setTransitionProperty(S transition, Void property) {
		setTransitionProperty(this, transition, property);
	}
	

	
	
	/*
	 * (non-Javadoc)
	 * @see net.automatalib.automata.fsa.MutableFSA#flipAcceptance()
	 */
	@Override
	public void flipAcceptance() {
		flipAcceptance(this);
	}
	
	@Override
	public S addState() {
		return addState(this);
	}
	
	@Override
	public S addState(Boolean property) {
		return addState(this, property);
	}
	
	@Override
	public S addInitialState() {
		return addInitialState(this);
	}
	
	@Override
	public S addInitialState(Boolean property) {
		return addInitialState(this, property);
	}
	
	@Override
	public S createTransition(S successor, Void properties) {
		return createTransition(this, successor, properties);
	}
	
	@Override
	public S copyTransition(S transition, S successor) {
		return copyTransition(this, transition, successor);
	}
	
	@Override
	public S addInitialState(boolean accepting) {
		return addInitialState(this, accepting);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy