00001 /* Copyright (C) 2004 Thomas N. Valine 00002 * tvaline@users.sourceforge.net 00003 * 00004 * This program is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU General Public License as published by the 00006 * Free Software Foundation; either version 2 of the License, or (at your 00007 * option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License along 00015 * with this program; if not, write to the Free Software Foundation, Inc., 00016 * 59 Temple Place - Suite 330, Boston, MA 00017 * 02111-1307, USA. */ 00018 00019 package com.ohrasys.cad.bnf; 00020 import java.util.*; 00021 00028 public class BNFNoFallthruTest 00029 extends BNFAbstractTest { 00031 protected int requirement; 00032 00040 public BNFNoFallthruTest(int requirement) 00041 throws BNFTestException { 00042 super(null); 00043 this.requirement = requirement; 00044 } 00045 00060 public BNFTestResult test(BNFTestableObject obj) { 00061 if(obj.getToken() == requirement) { 00062 result.setResult(result.FINISHED); 00063 result.addCommittableToken(obj); 00064 if(collecting){collectedData.add(obj);} 00065 } else { 00066 result.setResult(result.FAILED); 00067 result.addReplayableToken(obj); 00068 } 00069 BNFTestResult testResult = result; 00070 result = new BNFTestResult(); 00071 00072 return testResult; 00073 } 00074 00080 public String toString() { 00081 String name = getClass().getName(); 00082 int req = requirement; 00083 00084 return String.format(i18n.getString(i18n.i18n_RQMT), name, req); 00085 } 00086 00094 protected void checkTests() 00095 throws BNFTestException { 00096 if(tests != null){throw new BNFTestException();} 00097 } 00098 } // end class BNFNoFallthruTest 00099 00100 00101 /* This material is distributed under the GNU General Public License. 00102 * For more information please go to http://www.gnu.org/copyleft/gpl.html 00103 */