Kirk Rader  1.0-SNAPSHOT
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
us.rader.tt.formula.Operator Class Referenceabstract

A non-terminal Formula of the monadic predicate calculus. More...

Inheritance diagram for us.rader.tt.formula.Operator:
Inheritance graph

Public Member Functions

Set< ExpressiongetNodes ()
 
Set< ExpressiongetTerminalNodes ()
 
void printDigraph (final PrintStream stream, final int indent)
 
- Public Member Functions inherited from us.rader.tt.formula.Formula
abstract boolean evaluate (Map< Expression, Boolean > values)
 Evaluate this formula according to its truth table assuming the given values for its primitive terms. More...
 
final String toDigraph (final int indent) throws IOException
 
final void toDigraph (final PrintStream stream, final int indent)
 Write this formula's syntax tree as a Graphviz digraph. More...
 
final String toTruthTable (final int indent) throws IOException
 
final void toTruthTable (final PrintStream stream, final int indent) throws IOException
 Print this formula's truth table in LaTeX format to the given output stream. More...
 
- Public Member Functions inherited from us.rader.tt.formula.Expression
final boolean equals (final Object obj)
 Base equality on the string representation of a formula. More...
 
abstract Set< ExpressiongetNodes ()
 
abstract Set< ExpressiongetTerminalNodes ()
 
final int hashCode ()
 Base the hash code on the string representation of a formula. More...
 
abstract Expression replaceVariable (Variable boundVariable, Expression factor)
 Replace boundVariable with factor everywhere in this Expression. More...
 
final String toLaTeX () throws IOException
 
abstract void toLaTeX (PrintStream stream)
 Print the LaTeX representation of this object to the given stream. More...
 

Protected Member Functions

 Operator (final Formula... operands)
 
abstract String getOperator ()
 
abstract void printLaTeXOperator (PrintStream stream)
 
- Protected Member Functions inherited from us.rader.tt.formula.Expression
 Expression ()
 Initialize nodeName. More...
 

Protected Attributes

List< Formulaoperands
 The connective's operands. More...
 
- Protected Attributes inherited from us.rader.tt.formula.Expression
String nodeName
 Graphviz digraph node name. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from us.rader.tt.formula.Formula
static Formula parseFormula (final BufferedReader reader) throws IOException
 Parse the next Formula from the given buffered input stream. More...
 
static Formula parseFormula (final InputStream stream) throws IOException
 Parse the next Formula from the given input stream. More...
 
static Formula parseFormula (final String formula) throws IOException
 Parse the the given term. More...
 
- Static Public Member Functions inherited from us.rader.tt.formula.Expression
static Expression parseFactor (final BufferedReader reader) throws IOException
 Parse the next Expression from the given buffered input stream. More...
 
static Expression parseFactor (final InputStream stream) throws IOException
 Parse the next Expression from the given buffered input stream. More...
 
static Expression parseFactor (final String factor) throws IOException
 Parse the next Expression from the given buffered input stream. More...
 
- Static Protected Member Functions inherited from us.rader.tt.formula.Expression
static Expression parseVariableBindingOperator (final BufferedReader reader, final Class<? extends VariableBindingOperator > type, final char terminator) throws IOException
 Parse the next VariableBindingOperator or Description from the given buffered input stream. More...
 
static void printIndentation (final PrintStream stream, final int indent)
 Print the specified number of spaces to the given stream. More...
 
static int skipWhitespace (final BufferedReader reader) throws IOException
 Discard white space from the given buffered input stream. More...
 
- Static Package Functions inherited from us.rader.tt.formula.Expression
 [static initializer]
 

Detailed Description

A non-terminal Formula of the monadic predicate calculus.

Definition at line 28 of file Operator.java.

Constructor & Destructor Documentation

◆ Operator()

us.rader.tt.formula.Operator.Operator ( final Formula...  operands)
protected
Parameters
operandsoperands

Definition at line 39 of file Operator.java.

39  {
40 
41  this.operands = new ArrayList<>();
42 
43  for (final Formula operand : operands) {
44 
45  this.operands.add(operand);
46 
47  }
48  }
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

Member Function Documentation

◆ getNodes()

Set<Expression> us.rader.tt.formula.Operator.getNodes ( )
See also
Expression::getNodes

Definition at line 54 of file Operator.java.

54  {
55 
56  final Set<Expression> nodes = new HashSet<>();
57  nodes.add(this);
58 
59  for (final Formula operand : operands) {
60 
61  nodes.addAll(operand.getNodes());
62 
63  }
64 
65  return nodes;
66 
67  }
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

◆ getOperator()

abstract String us.rader.tt.formula.Operator.getOperator ( )
abstractprotected

◆ getTerminalNodes()

Set<Expression> us.rader.tt.formula.Operator.getTerminalNodes ( )
See also
Expression::getTerminalNodes

Definition at line 73 of file Operator.java.

73  {
74 
75  final Set<Expression> terms = new HashSet<>();
76 
77  for (final Formula operand : operands) {
78 
79  terms.addAll(operand.getTerminalNodes());
80 
81  }
82 
83  return terms;
84 
85  }
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

◆ printDigraph()

void us.rader.tt.formula.Operator.printDigraph ( final PrintStream  stream,
final int  indent 
)
See also
Graphable::printDigraph

Implements us.rader.tt.formula.Graphable.

Definition at line 91 of file Operator.java.

References us.rader.tt.formula.Operator.getOperator(), us.rader.tt.formula.Expression.nodeName, us.rader.tt.formula.Expression.printIndentation(), and us.rader.tt.formula.Operator.printLaTeXOperator().

91  {
92 
93  printIndentation(stream, indent);
94  stream.println(nodeName + " [ label=\"" + getOperator() + "\" ]");
95 
96  for (final Formula operand : operands) {
97 
98  operand.printDigraph(stream, indent);
99 
100  }
101 
102  printIndentation(stream, indent);
103  stream.print(nodeName + " -> {");
104 
105  for (final Formula operand : operands) {
106 
107  stream.print(" " + operand.nodeName);
108 
109  }
110 
111  stream.println(" }");
112 
113  }
abstract String getOperator()
String nodeName
Graphviz digraph node name.
Definition: Expression.java:90
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33
static void printIndentation(final PrintStream stream, final int indent)
Print the specified number of spaces to the given stream.

◆ printLaTeXOperator()

abstract void us.rader.tt.formula.Operator.printLaTeXOperator ( PrintStream  stream)
abstractprotected

Member Data Documentation

◆ operands

List<Formula> us.rader.tt.formula.Operator.operands
protected

The documentation for this class was generated from the following file: