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

A variable (lower-case alphabetic character) of the monadic predicate calculus. More...

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

Public Member Functions

 Variable (final String symbol)
 
Set< ExpressiongetNodes ()
 
Set< ExpressiongetTerminalNodes ()
 
void printDigraph (final PrintStream stream, final int indent)
 
Expression replaceVariable (final Variable boundVariable, final Expression factor)
 
void toLaTeX (final PrintStream stream)
 
String toString ()
 
- 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...
 

Private Attributes

final String symbol
 The lower-case letter. More...
 

Additional Inherited Members

- 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...
 
- Protected Member Functions inherited from us.rader.tt.formula.Expression
 Expression ()
 Initialize nodeName. 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.Expression
String nodeName
 Graphviz digraph node name. More...
 
- Static Package Functions inherited from us.rader.tt.formula.Expression
 [static initializer]
 

Detailed Description

A variable (lower-case alphabetic character) of the monadic predicate calculus.

Definition at line 27 of file Variable.java.

Constructor & Destructor Documentation

◆ Variable()

us.rader.tt.formula.Variable.Variable ( final String  symbol)
Parameters
symbolThe symbolic representation of this Variable

Definition at line 38 of file Variable.java.

References us.rader.tt.formula.Variable.symbol.

38  {
39 
40  this.symbol = symbol;
41 
42  }
final String symbol
The lower-case letter.
Definition: Variable.java:32

Member Function Documentation

◆ getNodes()

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

Definition at line 48 of file Variable.java.

48  {
49 
50  return new HashSet<>();
51 
52  }

◆ getTerminalNodes()

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

Definition at line 58 of file Variable.java.

Referenced by us.rader.tt.formula.VariableBindingOperator.getTerminalNodes().

58  {
59 
60  return new HashSet<>();
61 
62  }

◆ printDigraph()

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

Implements us.rader.tt.formula.Graphable.

Definition at line 68 of file Variable.java.

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

68  {
69 
70  printIndentation(stream, indent);
71  stream.print(nodeName);
72  stream.print(" [ label=\"");
73  stream.print(symbol);
74  stream.println("\" ]");
75 
76  }
final String symbol
The lower-case letter.
Definition: Variable.java:32
String nodeName
Graphviz digraph node name.
Definition: Expression.java:90
static void printIndentation(final PrintStream stream, final int indent)
Print the specified number of spaces to the given stream.

◆ replaceVariable()

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

Definition at line 82 of file Variable.java.

References us.rader.tt.formula.Expression.equals().

Referenced by us.rader.tt.formula.test.VariableTest.replaceDifferentVariableTest(), and us.rader.tt.formula.test.VariableTest.replaceSameVariableTest().

82  {
83 
84  if (equals(boundVariable)) {
85 
86  return factor;
87 
88  }
89 
90  return this;
91 
92  }
final boolean equals(final Object obj)
Base equality on the string representation of a formula.

◆ toLaTeX()

void us.rader.tt.formula.Variable.toLaTeX ( final PrintStream  stream)

◆ toString()

String us.rader.tt.formula.Variable.toString ( )
Returns
The symbolic representation of this Variable

Definition at line 108 of file Variable.java.

References us.rader.tt.formula.Variable.symbol.

Referenced by us.rader.tt.formula.UniversalGeneralization.getOperator(), us.rader.tt.formula.ExistentialGeneralization.getOperator(), and us.rader.tt.formula.Description.getOperator().

108  {
109 
110  return symbol;
111 
112  }
final String symbol
The lower-case letter.
Definition: Variable.java:32

Member Data Documentation

◆ symbol

final String us.rader.tt.formula.Variable.symbol
private

The lower-case letter.

Definition at line 32 of file Variable.java.

Referenced by us.rader.tt.formula.Variable.toString(), and us.rader.tt.formula.Variable.Variable().


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