Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright The Sett Ltd, 2005 to 2014.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package com.thesett.aima.logic.fol.wam.printer;
BasePrinter is a base class for writing debug pretty printers for compiled clauses.

It uses positional context information from a com.thesett.aima.logic.fol.compiler.PositionalTermTraverser, to determine whether terms are being entered or left, and splits these down into calls on appropriate enter/leave methods. Default no-op implementations of these methods are supplied by this base class and may be extended by specific printers to append data into table cells, using the addLineToRow(java.lang.String) and nextRow() methods.

CRC Card
Responsibilities Collaborations
Provide default enter/leave methods for every part of a term.
Accept lines of data appended into table cells.

Rupert Smith
public class BasePrinter extends BasePositionalVisitor
Defines the column that this printer outputs to.
    private final int currentColumn;

Holds the current row this printer is outputting to.
    protected int currentRow;

The context depth indenter.
    protected TraceIndenter indenter = new TraceIndenter(true);

The current indent.
    protected String indent = "";

The grid of cells to output to.
    private TextTableModel table;

Creates a printer.

interner The name interner.
symbolTable The compiler symbol table.
traverser The positional context traverser.
column The column to print to.
table The table to inform of cell sizes and positions.
    public BasePrinter(VariableAndFunctorInterner internerSymbolTable<IntegerStringObjectsymbolTable,
        PositionalTermTraverser traverserint columnTextTableModel table)
        this. = column;
        this. = table;

Adds a line of data to the current cell.

line The line to print in the current cell.
    protected void addLineToRow(String line)

Moves on to the next cell in the next row of the table.
    protected void nextRow()
New to GrepCode? Check out our FAQ X