Instructions for Implementing a New Parameter Type
Introduction:
To add an additional parameter type to the Structured Matcher program the following classes must be constructed and added to the Structured Matcher directory.
Each of the objects will be described as well as the methods needed to be implemented. This appendix closes with the actual code used to add the decimal range parameter type to Structured Matcher. The decimal range parameter type provided a type that could be answered with a value between 1 and 10 inclusively.
In the following objects foo will be used to represent the name of the new parameter type. When new parameters are created replace foo with the respective name, for example the a QstnFactory for the decimal range parameter was created foo was replace with decimal as in, DecimalQstnFactory.
To add a new parameter type to the Structured Matcher program, an instance of the QstnFactory must be added to the JComboBox in QuestionDefineDialog. An example of the code is shown in Figure 44.
This code is part of the constructor method in QuestionDefineDialog.
Overview of the Objects:
FooQstnFactory implements QuestionFactortyIF
Purpose: This class is used by the QuestionDefineDialog to create an instance of the proper Question, or to select the correct item by its creation type
Methods:
public Question makeQuestion( String ref, String body )
Creates an new instance of FooQuestion and sets the strategy variable to FooQstnAskStrategy
public boolean isCreatorOfType( Class cls )
Checks to see if cls is the class of Question this factory creates
public String toString( )
Returns the String to be used in the JComboBox
as can be seen in the drop-down menu below

Figure 45: Example of DecimalQstnFactory
FooQstn extends Question
Purpose: Return the proper cell editor for FooCEle
Methods:
public FooQstn( String name, String body ) // Constructor
Call the constructor for Question and pass on the name and body Strings, but also include the FooQstn.class variable that will be used for the questions type.
public TableCellEditor getCellEditor( )
Return the proper cell editor for FooCEle
FooQstn is part of the model, and does not have a visual representation
FooCEle implements CellElementIF
Purpose: Manage (create, edit, evaluate) a matching constraint for the parameter type
Methods:
public boolean evaluate(Object colId, Hashtable caseRef)
throws UserCanceledException;
Resolve whether the value(answer) matches the matching constraint held in this cell element.
colId
: is the ColumnIdentifier for the column ( ie the Question or SimpleMatcher)caseRef
: the case hashtable. If the question has been resolved before, the answer will be recorded here. If the question has not be answered, then ask the question and record the answerpublic String toString( )
used to return a String representation of the cell element to be displayed in the table

Figure 46. Example of DecimalCEle in use
His explanation: "There is a difference; with the Boolean question type I used BooleanCEle because there weren't any relationship operators displayed in the cell element where with the Likelihood and Decimal question type there is a relationship operator that is also displayed, and so that is the reason for the difference in names."
FooQstnAskStrategy implements QuestionAskStrategyIF
Purpose: To provide a JPanel with window widgets for getting an answer for a question of this parameter type.
Methods:
public Object getAnswer( )
Get the answer selected from the widgets in the JPanel returned by getOptionPanel
public JPanel getOptionPanel( )
Provide a JPanel with window widgets for getting an answer for a question of this parameter type.

Figure 47.Example of DecimalQstnAskStrategy
JPanel returned and managed by the QstnAskStrategy
FooCellEditor implements TableCellEditor
CellEditor
object is only needed if something is needed beyond what is provided by DefaultCellEditor that is part of the Swing package. DecimalCellEditor uses a dialog to get the information so it is more complicated, so a sequence diagram is provided below to show how the methods are called

Figure 48. Example of DecimalCellEditor
DecimalQstnFactory Example
gui
DecimalQstn Example
back to specs
DecimalRelCEle Example
gui
DecimalQstnAskStrategy Example
gui
DecimalCellEditor Example
gui
Definition of Terms
Cell: A location within a truth table that holds a matching constraint for a parameter ( question or simple matcher).
Expert: A person who has knowledge in a particular field, and will use the Structured Matcher program to construct an environment ( combination of parameters and matching constraints) where a hypothesis can be tested.
Matching Constraint: A set of values, defined by the expert, used in comparison with the answer, given by the non-expert, for a parameter to evaluate whether a cell is considered to be a match ( true ). If the non-expert’s answer falls within the set of values defined by the expert, a cell will be considered to have matched.
Non-expert: A person who will supply the values to a predefined environment defined by an expert resulting in a confidence level of the hypothesis being tested.
Parameter: Elements that are pertinent in the determination of a hypothesis. A parameter will have a set number of valid values. Often a parameter takes the form of a question.
Simple Matcher: Another name for a truth table.
Structured Matcher: A software program that provides the artificial intelligence technique of Structured Matching.
Structured Matching: A tree like hierarchy of truth tables used to provide hypothesis testing. The tree structure provides a way to transform complex decisions into a simpler forms by breaking a decision into sub-decisions. In the tree structure, the branches would represent the sub-decisions and the root of the tree would represent the overall decision.
Truth Table: A logical structure used to establish a relationship between parameters and matching conditions in a way that a confidence level can be given for a hypothesis based the configuration of the matching conditions for the parameters. The columns of the table will represent the parameters pertinent to the hypothesis. The rows of the table will represent different possible hypothesis resolutions based on varying matching constraints.
Value: An answer given in response to a parameter or question in a truth table. This answer will be compared to the matching constraints set up in the cells of the column of the truth table representing the particular parameter.