/* * Copyright (C) 2011-2016 Matthias Heizmann (heizmann@informatik.uni-freiburg.de) * Copyright (C) 2009-2016 University of Freiburg * * This file is part of the ULTIMATE Automata Library. * * The ULTIMATE Automata Library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ULTIMATE Automata Library 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 the ULTIMATE Automata Library. If not, see . * * Additional permission under GNU GPL version 3 section 7: * If you modify the ULTIMATE Automata Library, or any covered work, by linking * or combining it with Eclipse RCP (or a modified version of Eclipse RCP), * containing parts covered by the terms of the Eclipse Public License, the * licensors of the ULTIMATE Automata Library grant you additional permission * to convey the resulting work. */ package de.uni_freiburg.informatik.ultimate.automata; import de.uni_freiburg.informatik.ultimate.automata.statefactory.IStateFactory; import de.uni_freiburg.informatik.ultimate.automata.statefactory.StringFactory; /** * Interface for all automata operations (like, e.g., intersection, complementation, minimization).
* We have the following conventions. * * By convention the constructor of an IOperation has the following parameters. * * * @author Matthias Heizmann (heizmann@informatik.uni-freiburg.de) * @param * Type of objects that are contained in the alphabet. * @param * Type of objects that are used to label states (resp. places for Petri nets) * @param * type of {@link IStateFactory} that is used in the {@link #checkResult(IStateFactory)} method */ public interface IOperation> { /** * @return Name of the operation.
* The name is determined by the class name. Do not override this method. */ default String getOperationName() { return computeOperationName(getClass()); } /** * @return Message that should be logged when the operation is started.
* Use some information like:
* "Started operation Intersection. First operand has 2394 states, second operand has 9374 states." */ default String startMessage() { return "Started " + getOperationName() + '.'; } /** * @return Message that should be logged when the operation is finished.
* Use some information like: "Finished operation intersection. Result has 345 states." */ default String exitMessage() { return "Finished " + getOperationName() + '.'; } /** * @return The result of the operation. */ Object getResult(); /** * Run some checks to test correctness of the result. * * @param stateFactory * If new automata have to be built, use this state factory. * @return {@code true} iff all checks succeeded. * @throws AutomataLibraryException * if checks fail or timeout was requested */ boolean checkResult(CRSF stateFactory) throws AutomataLibraryException; /** * Get information about the performance (e.g., runtime) of the operation. *

* Delivering this information is optional.
* This method should only be called by statistic collection frameworks. Implementing classes may decide to only * compute the statistics on demand, so this may be an expensive method. It is, however, not wise to keep huge data * structures in memory just for creating statistics data. * * @return statistics object */ default AutomataOperationStatistics getAutomataOperationStatistics() { return null; } /** * @param clazz * Class object. * @param * class type (must inherit {@link IOperation} * @return automata script interpreter */ static > String computeOperationName(final Class clazz) { final String className = clazz.getSimpleName(); return Character.toLowerCase(className.charAt(0)) + className.substring(1); } }