All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class designer.TableMatcher

java.lang.Object
   |
   +----designer.TableMatcher

public class TableMatcher
extends Object
Class Name: TableMatcher
Purpose: This class represents a table matcher. A table
matcher simply evaluates elements in "row-major" to form
a result for each row. Each row has boolean "computable" elements,
each evaluated as part of an overall "AND" boolean condition. Columns
coorespond to variables, rows coorespond to conditions. A table matcher
will return something in the range (-3,3), with -3 being most negative
and 3 being most positive. Each row in the table does NOT need equal length.
In some cases, "don't care" conditions will shrink the lenght of the LogicalOperation
because anything AND'd with don't care is the anything. (i.e no need to insert).


Constructor Index

 o TableMatcher(int, int)
This is the first constructor of the TableMatcher class.

Method Index

 o addLogicalOperation(LogicalOperation, int)
This method will provide users with ways of adding (appending)
a boolean expression onto the table, at a particular row.
 o execute()
This method will execute the table matcher.
 o getTargetRow()
This method is used, in the event of a successful return value
from execute(), to retrieve the array position where success occurred.
 o setFalseResult(int, int)
 o setResult(int, int)
This method allow setting of the result value for a particular row
PRE: rowNumber >= 0 && rowNumber < _trueResult.size();
POST: none

Constructors

 o TableMatcher
 public TableMatcher(int numberTableRows,
                     int numberTableColumns)
This is the first constructor of the TableMatcher class.
This constructor should be used when the actual table is to
be built "on the fly".
PRE: Number of table rows must be greater than 0.
POST: TableMatcher object constructed.

Methods

 o setResult
 public void setResult(int rowNumber,
                       int value)
This method allow setting of the result value for a particular row
PRE: rowNumber >= 0 && rowNumber < _trueResult.size();
POST: none

 o setFalseResult
 public void setFalseResult(int rowNumber,
                            int value)
 o addLogicalOperation
 public void addLogicalOperation(LogicalOperation logicalOperationToAdd,
                                 int row)
This method will provide users with ways of adding (appending)
a boolean expression onto the table, at a particular row.
PRE: The table must be already constructed. (not null). The
passed logical operation must not be null. The row must be accessable
POST: The logical operation must be attached.

 o execute
 public int execute()
This method will execute the table matcher. The table is executed
in order, meaning row 0 visited first. When the first occurrence of
"true" is found, its return value is compared to max return value. The
maximum return value is returned to the caller. The caller can
then query as to target row with getTargetRow().
PRE: loArray is not null and has something in it.
POST: maximum return value for all the rows or the first instance of 3

 o getTargetRow
 public int getTargetRow()
This method is used, in the event of a successful return value
from execute(), to retrieve the array position where success occurred.
PRE: If execute() has not been called, or a match was not successful,
then -1 will be returned. Otherwise a valid row number will be returned.
POST: Nothing


All Packages  Class Hierarchy  This Package  Previous  Next  Index