00001 /* 00002 * (c) copyright 2008, Technische Universitaet Graz and Technische Universitaet Wien 00003 * 00004 * This file is part of jdiagengine. 00005 * 00006 * jdiagengine is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * jdiagengine is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * You should have received a copy of the GNU General Public License 00016 * along with jdiagengine. If not, see <http://www.gnu.org/licenses/>. 00017 * 00018 * Authors: Joerg Weber, Franz Wotawa 00019 * Contact: jweber@ist.tugraz.at (preferred), or fwotawa@ist.tugraz.at 00020 * 00021 */ 00022 00023 00036 package theoremprover; 00037 00038 import java.lang.*; // Java language classes 00039 import java.util.*; // Java util... 00040 00041 import theoremprover.*; 00042 00043 00044 public class PropositionalRule extends Object 00045 { 00046 00047 // Instance variables ... 00048 00049 protected ArrayList antecedence; 00050 protected Object succedence; 00051 protected int counter; 00052 00053 // Instance creation and initialization 00054 00055 PropositionalRule () 00056 { 00057 antecedence = new ArrayList(); 00058 succedence = null; 00059 counter = 0; 00060 } 00061 00062 // Accessing 00063 00064 public String toString() 00065 { 00066 StringBuffer str = new StringBuffer(); 00067 Iterator e = antecedence.iterator(); 00068 int i = antecedence.size(); 00069 while (e.hasNext()) { 00070 str.append((e.next()).toString()); 00071 i--; 00072 if (i>0) { str.append(", ");} 00073 } 00074 str.append(" -> "); 00075 str.append(succedence.toString()); 00076 str.append("."); 00077 return str.toString(); 00078 } 00079 00080 // Accessing and maintaining structure 00081 00082 public void addToAntecedence(Object p) 00083 { 00084 antecedence.add(p); 00085 } 00086 00087 public ArrayList antecedence() 00088 { 00089 return antecedence; 00090 } 00091 00092 public void counter(int i) 00093 { 00094 counter = i; 00095 } 00096 00097 public int counter() 00098 { 00099 return counter; 00100 } 00101 00102 public void succedence(Object p) 00103 { 00104 succedence = p; 00105 } 00106 00107 public Object succedence() 00108 { 00109 return succedence; 00110 } 00111 }