1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using aima . core . logic . propositional . parsing . ast ;
4
+
5
+ namespace aima . core . logic . propositional . parsing
6
+ {
7
+ /**
8
+ * <b>Propositional Logic Visitor:</b> A <a
9
+ * href="http://en.wikipedia.org/wiki/Visitor_pattern">Visitor Pattern/</a> for
10
+ * traversing the abstract syntax tree structural representation of
11
+ * propositional logic used in this library. The key difference between the
12
+ * default Visitor pattern and the code here, is that in the former the visit()
13
+ * methods have a void visit(ConcreteNode) signature while the visitors used
14
+ * here have a Object visit(ConcreteNode, Object arg) signature. This simplifies
15
+ * testing and allows some recursive code that is hard with the former .
16
+ *
17
+ * @author Ravi Mohan
18
+ * @author Ciaran O'Reilly
19
+ *
20
+ * @param <A>
21
+ * the argument type to be passed to the visitor methods.
22
+ * @param <R>
23
+ * the return type to be returned from the visitor methods.
24
+ */
25
+ public interface PLVisitor < A , R >
26
+ {
27
+ /**
28
+ * Visit a proposition symbol (e.g A).
29
+ *
30
+ * @param sentence
31
+ * a Sentence that is a propositional symbol.
32
+ * @param arg
33
+ * optional argument to be used by the visitor.
34
+ * @return optional return value to be used by the visitor.
35
+ */
36
+ R visitPropositionSymbol ( PropositionSymbol sentence , A arg ) ;
37
+
38
+ /**
39
+ * Visit a unary complex sentence (e.g. ~A).
40
+ *
41
+ * @param sentence
42
+ * a Sentence that is a unary complex sentence.
43
+ * @param arg
44
+ * optional argument to be used by the visitor.
45
+ * @return optional return value to be used by the visitor.
46
+ */
47
+ R visitUnarySentence ( ComplexSentence sentence , A arg ) ;
48
+
49
+ /**
50
+ * Visit a binary complex sentence (e.g. A & B).
51
+ *
52
+ * @param sentence
53
+ * a Sentence that is a binary complex sentence.
54
+ * @param arg
55
+ * optional argument to be used by the visitor.
56
+ * @return optional return value to be used by the visitor.
57
+ */
58
+ R visitBinarySentence ( ComplexSentence sentence , A arg ) ;
59
+ }
60
+ }
0 commit comments