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

"Not" operator. More...

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

Public Member Functions

 Negation (final Formula operand)
 Initialize Operator. More...
 
boolean evaluate (final Map< Expression, Boolean > values)
 
Expression replaceVariable (final Variable boundVariable, final Expression factor)
 
void toLaTeX (final PrintStream stream)
 
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

String getOperator ()
 
void printLaTeXOperator (final PrintStream stream)
 
- 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...
 

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...
 
- 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...
 
- Static Package Functions inherited from us.rader.tt.formula.Expression
 [static initializer]
 

Detailed Description

"Not" operator.

Definition at line 25 of file Negation.java.

Constructor & Destructor Documentation

◆ Negation()

us.rader.tt.formula.Negation.Negation ( final Formula  operand)

Initialize Operator.

Parameters
operandThe operand.

Definition at line 33 of file Negation.java.

Referenced by us.rader.tt.formula.Negation.replaceVariable().

33  {
34 
35  super(operand);
36 
37  }

Member Function Documentation

◆ evaluate()

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

Definition at line 43 of file Negation.java.

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

43  {
44 
45  return !operands.get(0).evaluate(values);
46 
47  }
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

◆ getOperator()

String us.rader.tt.formula.Negation.getOperator ( )
protected
See also
Operator::getOperator

Definition at line 84 of file Negation.java.

Referenced by us.rader.tt.formula.Negation.toString().

84  {
85 
86  return "~";
87 
88  }

◆ printLaTeXOperator()

void us.rader.tt.formula.Negation.printLaTeXOperator ( final PrintStream  stream)
protected
See also
Operator::printLaTeXOperator

Definition at line 94 of file Negation.java.

Referenced by us.rader.tt.formula.Negation.toLaTeX().

94  {
95 
96  stream.print("\\lognot ");
97 
98  }

◆ replaceVariable()

Expression us.rader.tt.formula.Negation.replaceVariable ( final Variable  boundVariable,
final Expression  factor 
)
See also
Expression::replaceVariable

Definition at line 53 of file Negation.java.

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

53  {
54 
55  return new Negation((Formula) operands.get(0).replaceVariable(boundVariable, factor));
56 
57  }
Negation(final Formula operand)
Initialize Operator.
Definition: Negation.java:33
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

◆ toLaTeX()

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

Definition at line 63 of file Negation.java.

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

63  {
64 
65  printLaTeXOperator(stream);
66  operands.get(0).toLaTeX(stream);
67 
68  }
void printLaTeXOperator(final PrintStream stream)
Definition: Negation.java:94
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

◆ toString()

String us.rader.tt.formula.Negation.toString ( )
Returns
The string representation of this formula.

Definition at line 74 of file Negation.java.

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

74  {
75 
76  return getOperator() + operands.get(0).toString();
77 
78  }
List< Formula > operands
The connective&#39;s operands.
Definition: Operator.java:33

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