1 /* 2 wsmo4j - a WSMO API and Reference Implementation 3 4 Copyright (c) 2005, University of Innsbruck, Austria 5 6 This library is free software; you can redistribute it and/or modify it under 7 the terms of the GNU Lesser General Public License as published by the Free 8 Software Foundation; either version 2.1 of the License, or (at your option) 9 any later version. 10 This library is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 details. 14 You should have received a copy of the GNU Lesser General Public License along 15 with this library; if not, write to the Free Software Foundation, Inc., 16 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 package org.omwg.logicalexpression; 19 20 21 /** 22 * <p>This interface represents an visitor for the logical expression 23 * tree structure.</p> 24 * <p>The visitor design pattern is a way of separating an algorithm from an object 25 * structure. A practical result of this separation is the ability to add new 26 * operations to existing object structures without modifying those structures.</p> 27 * <p>The idea is to use a structure of element classes, each of which has an accept 28 * method that takes a visitor object as an argument. The visitor is an interface 29 * that has a different visit() method for each element class. The accept() method 30 * of an element class calls back the visit() method for its class. Separate 31 * concrete visitor classes can then be written that perform some particular 32 * operations.</p> 33 * @author DERI Innsbruck, reto.krummenacher@deri.org 34 * @version $Revision: 1026 $ $Date: 2005-09-20 16:21:32 +0300 (Tue, 20 Sep 2005) $ 35 * @see <a href="http://en.wikipedia.org/wiki/Visitor_pattern">Visitor Pattern</a> 36 */ 37 public interface Visitor { 38 39 /** 40 * @param expr Atom 41 */ 42 void visitAtom(Atom expr); 43 44 /** 45 * @param expr Molecule 46 */ 47 void visitCompoundMolecule(CompoundMolecule expr); 48 49 /** 50 * @param expr SubConceptMolecule 51 */ 52 void visitSubConceptMolecule(SubConceptMolecule expr); 53 54 /** 55 * @param expr 56 */ 57 void visitMemberShipMolecule(MembershipMolecule expr); 58 59 /** 60 * @param expr 61 */ 62 void visitAttributeValueMolecule(AttributeValueMolecule expr); 63 64 /** 65 * @param expr 66 */ 67 void visitAttributeContraintMolecule(AttributeConstraintMolecule expr); 68 69 /** 70 * @param expr 71 */ 72 void visitAttributeInferenceMolecule(AttributeInferenceMolecule expr); 73 74 /** 75 * @param expr NEG 76 */ 77 void visitNegation(Negation expr); 78 79 /** 80 * @param expr NAF 81 */ 82 void visitNegationAsFailure(NegationAsFailure expr); 83 84 /** 85 * @param expr CONSTRAINT 86 */ 87 void visitConstraint(Constraint expr); 88 89 /** 90 * @param expr AND 91 */ 92 void visitConjunction(Conjunction expr); 93 94 /** 95 * @param expr OR 96 */ 97 void visitDisjunction(Disjunction expr); 98 99 /** 100 * @param expr IMPLIEDBY 101 */ 102 void visitInverseImplication(InverseImplication expr); 103 104 /** 105 * @param expr IMPLIES 106 */ 107 void visitImplication(Implication expr); 108 109 /** 110 * @param expr EQUIVALENT 111 */ 112 void visitEquivalence(Equivalence expr); 113 114 /** 115 * @param expr IMPLIESLP 116 */ 117 void visitLogicProgrammingRule(LogicProgrammingRule expr); 118 119 /** 120 * @param expr FORALL 121 */ 122 void visitUniversalQuantification(UniversalQuantification expr); 123 124 /** 125 * @param expr EXISTS 126 */ 127 void visitExistentialQuantification(ExistentialQuantification expr); 128 129 }