All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class javaParse.ParseTable

java.lang.Object
   |
   +----javaParse.ParseTable

public class ParseTable
extends Object

Constructor Index

 o ParseTable(String[], String[])

Method Index

 o addString(char, char, String)
 o addString(String, String, String)
 o colIndex(String)
 o getColLabels()
 o getParseTableAsMatrix()
 o getRowLabels()
 o hasMultipleEntries()
 o rowIndex(String)
 o setParseTableMatrix(String[][])
used to reset the parse table to the user's entered table (this is done in case there are conflicts in the table and the user wants to rearrange the conflicts so that one rule is used instead of another)
 o stringAt(char, char)
 o stringAt(String, String)

Constructors

 o ParseTable
 public ParseTable(String rowLabels[],
                   String colLabels[])
Parameters:
rowLabels - all Strings in this array are valid row indexes
colLabels - all Strings in this array are valid col indexes all Strings in rows and cols MUST be completely unique, no parsing tables share a col or row label

Methods

 o addString
 public void addString(String row,
                       String col,
                       String addMe)
Parameters:
row - the row coord
col - the col coord
addMe - any unique String that exists at position Table(row,col) can even add multiple Strings at one position since stringAt returns a String of Strings which are separated by spaces addMe can contain multiple entries already, separated by a space DOES NOT ADD DUPLICATES!!! -- will check for Dupes
 o rowIndex
 public int rowIndex(String row)
Parameters:
returns - array index of where the given string appears in
the - table
 o colIndex
 public int colIndex(String col)
Parameters:
returns - array index of where the given string appears in
the - table
 o addString
 public void addString(char row,
                       char col,
                       String addMe)
Parameters:
row - the row coord will be converted to a String for you
col - the col coord will be converted to a String for you
addMe - any String that exists at position Table(row,col) can even add multiple Strings at one position since stringAt returns a String of Strings which are separated by spaces DOES NOT ADD DUPLICATES!!! -- will check for Dupes
 o stringAt
 public String stringAt(String row,
                        String col)
Parameters:
row - the row coord
col - the col coord
Returns:
the String at position Table(row,col) Note: if the String returned == "", then the entry is an ERROR also, blanks in the String indicate conflicts
 o stringAt
 public String stringAt(char row,
                        char col)
Parameters:
row - the row coord will be converted to a String for you
col - the col coord will be converted to a String for you
Returns:
the String at position Table(row,col) Note: if the String returned == "", then the entry is an ERROR also, blanks in the String indicate conflicts
 o hasMultipleEntries
 public boolean hasMultipleEntries()
Returns:
returns true if one or more entries in the Table contains multiple Strings, thus the table has conflicts that will not allow the user to parse a String
 o getRowLabels
 public String[] getRowLabels()
Returns:
returns a reference to the rowLabels that were originally sent to the constructor since this class assumes that a call to this function is only for traversing the table, not changing the labels This just saves copying an array that will be trashed once the user has used to move through his table
 o getColLabels
 public String[] getColLabels()
Returns:
returns a reference to the colLabels that were originally sent to the constructor since this class assumes that a call to this function is only for traversing the table, not changing the labels This just saves copying an array that will be trashed once the user has used to move through his table
 o getParseTableAsMatrix
 public String[][] getParseTableAsMatrix()
Returns:
returns a newly allocated double array (matrix) Given: RowLabels[ S, A, B ] ColLabels[ a, b, c, $ ] a b c $ S 0 0 0 0 the 0s represent Strings stored in A 0 0 0 0 the double matrix which is being returned B 0 0 0 0 such that stringAt(S,a) can now be referenced as [0,0]
 o setParseTableMatrix
 public void setParseTableMatrix(String matrix[][])
used to reset the parse table to the user's entered table (this is done in case there are conflicts in the table and the user wants to rearrange the conflicts so that one rule is used instead of another)


All Packages  Class Hierarchy  This Package  Previous  Next  Index