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.util.ts.acceptors; 018 019public interface AcceptanceCombiner { 020 public static AcceptanceCombiner AND = new AcceptanceCombiner() { 021 @Override 022 public boolean combine(boolean a1, boolean a2) { 023 return a1 && a2; 024 } 025 }; 026 027 public static AcceptanceCombiner OR = new AcceptanceCombiner() { 028 @Override 029 public boolean combine(boolean a1, boolean a2) { 030 return a1 || a2; 031 } 032 }; 033 034 public static AcceptanceCombiner XOR = new AcceptanceCombiner() { 035 @Override 036 public boolean combine(boolean a1, boolean a2) { 037 return a1 ^ a2; 038 } 039 }; 040 041 public static AcceptanceCombiner EQUIV = new AcceptanceCombiner() { 042 @Override 043 public boolean combine(boolean a1, boolean a2) { 044 return (a1 == a2); 045 } 046 }; 047 048 public static AcceptanceCombiner IMPL = new AcceptanceCombiner() { 049 @Override 050 public boolean combine(boolean a1, boolean a2) { 051 return !a1 || a2; 052 } 053 }; 054 055 /** 056 * Combine two acceptance values. 057 * @param a1 058 * @param a2 059 * @return 060 */ 061 public boolean combine(boolean a1, boolean a2); 062}