Inheritance diagram for LogicTree::

Public Methods | |
| String | toString () |
| abstract void | toStringBuffer (String indentation, StringBuffer buffer) |
| boolean | isFailure () |
Static Public Methods | |
| LogicTree | iff (LogicTree leftSubtree, LogicTree rightSubtree) |
| LogicTree | implies (LogicTree leftSubtree, LogicTree rightSubtree) |
| LogicTree | or (LogicTree leftSubtree, LogicTree rightSubtree) |
| LogicTree | and (LogicTree leftSubtree, LogicTree rightSubtree) |
| LogicTree | not (LogicTree subtree) |
| LogicTree | var (char name) |
| LogicTree | failure (String cause) |
| void | main (String arg[]) |
Static Private Attributes | |
| LogicTree | C0 = new False() |
| LogicTree | C1 = new True() |
| String | additionalIndentation = " " |
Definition at line 9 of file LogicTree.java.
|
|
pseudo-constructor for an "and" tree Definition at line 97 of file LogicTree.java. Referenced by main(). 00098 {
00099 return new And(leftSubtree, rightSubtree);
00100 }
|
|
|
pseudo-constructor for a failure Definition at line 127 of file LogicTree.java. 00128 {
00129 return new Failure(cause);
00130 }
|
|
|
pseudo-constructor for an "iff" tree Definition at line 67 of file LogicTree.java. Referenced by main(). 00068 {
00069 return new Iff(leftSubtree, rightSubtree);
00070 }
|
|
|
pseudo-constructor for an "implies" tree Definition at line 77 of file LogicTree.java. Referenced by main(). 00078 {
00079 return new Implies(leftSubtree, rightSubtree);
00080 }
|
|
|
Tell whether this tree is a failure. Definition at line 57 of file LogicTree.java. 00058 {
00059 return this instanceof Failure;
00060 }
|
|
|
test program that constructs several trees and displays them Definition at line 137 of file LogicTree.java. 00138 {
00139 System.out.println("Tree for: (a+b)' = a'*b'");
00140 System.out.println(
00141 iff(
00142 not(or(var('a'), var('b'))),
00143 and(not(var('a')), not(var('b')))
00144 ) );
00145
00146 System.out.println("Tree for: c > 1");
00147 System.out.println(
00148 implies(var('c'), C1)
00149 );
00150
00151 System.out.println("Tree for: 0 > d");
00152 System.out.println(
00153 implies(C0, var('d'))
00154 );
00155
00156 System.out.println("Tree for: a + a'*b = a + b");
00157 System.out.println(
00158 iff(
00159 or(var('a'), and(not(var('a')), var('b'))),
00160 or(var('a'), var('b')))
00161 );
00162 }
|
|
|
pseudo-constructor for a "not" tree Definition at line 107 of file LogicTree.java. Referenced by main(). 00108 {
00109 return new Not(subtree);
00110 }
|
|
|
pseudo-constructor for an "or" tree Definition at line 87 of file LogicTree.java. Referenced by main(). 00088 {
00089 return new Or(leftSubtree, rightSubtree);
00090 }
|
|
|
Convert the tree to a String representation. Definition at line 37 of file LogicTree.java. 00038 {
00039 StringBuffer buffer = new StringBuffer();
00040 toStringBuffer("", buffer);
00041 return buffer.toString();
00042 }
|
|
|
Put the tree's representation into a StringBuffer. Reimplemented in BinaryTree, UnaryTree, Unit, and Failure. Referenced by toString(), UnaryTree::toStringBuffer(), and BinaryTree::toStringBuffer(). |
|
|
pseudo-constructor for a logical variable Definition at line 117 of file LogicTree.java. Referenced by main(). 00118 {
00119 return new Var(name);
00120 }
|
|
|
C0 is a tree for the constant 0 (false). Definition at line 15 of file LogicTree.java. |
|
|
C1 is a tree for the constant 1 (true). Definition at line 22 of file LogicTree.java. |
|
|
additionalIndentation determines how much additional Indentation there is at each level of the tree when it is converted to a String. Definition at line 30 of file LogicTree.java. |
1.2.6 written by Dimitri van Heesch,
© 1997-2001