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

Generalization. More...

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

Public Member Functions

final boolean evaluate (final Map< Expression, Boolean > values)
 
Set< ExpressiongetTerminalNodes ()
 
final Formula instantiate (final Expression factor)
 Return the Formula that results from instantiating this operator. More...
 
void printDigraph (final PrintStream stream, final int indent)
 
final void toLaTeX (final PrintStream stream)
 
final String toString ()
 
- Public Member Functions inherited from us.rader.tt.formula.Operator
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

 VariableBindingOperator (final Variable variable, final Formula operand)
 Initialize variable and Operator. More...
 
- Protected Member Functions inherited from us.rader.tt.formula.Operator
 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

Variable variable
 The variable bound by this operator. More...
 
- Protected Attributes inherited from us.rader.tt.formula.Operator
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

Generalization.

Definition at line 26 of file VariableBindingOperator.java.

Constructor & Destructor Documentation

◆ VariableBindingOperator()

us.rader.tt.formula.VariableBindingOperator.VariableBindingOperator ( final Variable  variable,
final Formula  operand 
)
protected

Initialize variable and Operator.

Parameters
variablevariable
operandFormula in which variable is bound.

Definition at line 42 of file VariableBindingOperator.java.

References us.rader.tt.formula.VariableBindingOperator.variable.

42  {
43 
44  super(operand);
45  this.variable = variable;
46 
47  }
Variable variable
The variable bound by this operator.

Member Function Documentation

◆ evaluate()

final boolean us.rader.tt.formula.VariableBindingOperator.evaluate ( final Map< Expression, Boolean >  values)
See also
Formula::evaluate

Definition at line 53 of file VariableBindingOperator.java.

Referenced by us.rader.tt.formula.test.ExistentialGeneralizationTest.evaluateTest().

53  {
54 
55  throw new IllegalArgumentException("Variable binding operators cannot be evaluated");
56 
57  }

◆ getTerminalNodes()

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

Definition at line 63 of file VariableBindingOperator.java.

References us.rader.tt.formula.Variable.getTerminalNodes().

63  {
64 
65  final Set<Expression> terminalNodes = super.getTerminalNodes();
66  terminalNodes.addAll(variable.getTerminalNodes());
67  return terminalNodes;
68 
69  }
Set< Expression > getTerminalNodes()
Definition: Variable.java:58
Variable variable
The variable bound by this operator.

◆ instantiate()

final Formula us.rader.tt.formula.VariableBindingOperator.instantiate ( final Expression  factor)

Return the Formula that results from instantiating this operator.

Parameters
factorThe new free value for this operator's bound variable.
Returns
The instantiated Formula.

Definition at line 79 of file VariableBindingOperator.java.

References us.rader.tt.formula.Operator.operands.

Referenced by us.rader.tt.formula.test.DescriptionTest.instantiateTest(), us.rader.tt.formula.test.UniversalGeneralizationTest.instantiateTest(), and us.rader.tt.formula.test.ExistentialGeneralizationTest.instantiateTest().

79  {
80 
81  return (Formula) operands.get(0).replaceVariable(variable, factor);
82 
83  }
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33
Variable variable
The variable bound by this operator.

◆ printDigraph()

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

Implements us.rader.tt.formula.Graphable.

Definition at line 89 of file VariableBindingOperator.java.

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

89  {
90 
91  super.printDigraph(stream, indent);
92  printIndentation(stream, indent);
93  stream.print(nodeName);
94  stream.print(" [ label=\"");
95  stream.print(getOperator());
96  stream.println("\" ]");
97  stream.print(nodeName);
98  stream.print(" -> ");
99  stream.println(operands.get(0).nodeName);
100 
101  }
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.

◆ toLaTeX()

final void us.rader.tt.formula.VariableBindingOperator.toLaTeX ( final PrintStream  stream)
See also
Formula::toLaTeX

Definition at line 107 of file VariableBindingOperator.java.

References us.rader.tt.formula.Operator.operands, and us.rader.tt.formula.Operator.printLaTeXOperator().

107  {
108 
109  printLaTeXOperator(stream);
110  operands.get(0).toLaTeX(stream);
111 
112  }
abstract void printLaTeXOperator(PrintStream stream)
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

◆ toString()

final String us.rader.tt.formula.VariableBindingOperator.toString ( )
Returns
String representation of this formula.

Definition at line 118 of file VariableBindingOperator.java.

References us.rader.tt.formula.Operator.getOperator(), and us.rader.tt.formula.Operator.operands.

118  {
119 
120  return getOperator() + operands.get(0).toString();
121 
122  }
abstract String getOperator()
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

Member Data Documentation

◆ variable

Variable us.rader.tt.formula.VariableBindingOperator.variable
protected

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