viper.filters
Class LimitationsParser

java.lang.Object
  extended byviper.filters.LimitationsParser
All Implemented Interfaces:
ErrorWriter

public class LimitationsParser
extends java.lang.Object
implements ErrorWriter

Purpose: Will parse out the limitations which will be used to figure out the subset from the test set and the result set which will be used for comparissons in the gtfC.


Constructor Summary
LimitationsParser()
          Creates a new limitations/rules parser.
 
Method Summary
static RuleHolder parse(VReader reader, DescriptorConfigs dcfgs)
          Parses the current block in the VReader for the limitations information that is found in that block.
 RuleHolder parseFile(java.lang.String file_path, java.lang.String block_name, DescriptorList d_vector)
          Parses the file given for the block name that is given and for the limitations information that is found in that block.
 void printError(java.lang.String error)
          The function that prints an error to the output stream.
 void printError(java.lang.String message, int start, int stop)
          Print an error at a specific place inside the current line.
 void printErrorAtLineNumber(java.lang.String error, int line_num)
          The function that prints an error and a line number of the file in which the error has occured.
 void printErrorTotals()
          The function that will print the total number of errors that occured in the file.
 void printGeneralError(java.lang.String error)
          The function that prints a general error to the output file.
 void printWarning(java.lang.String warning)
          The function that print a warning message to the output file.
 void printWarning(java.lang.String message, int start, int stop)
          Print an warning at a specific place inside the current line.
 void printWarningAtLineNumber(java.lang.String warning, int line_num)
          The function that prints a warning message and the line number that is attributed to this warning.
 void setOutput(java.io.PrintWriter output)
          Function that allows you to set a different output to which warnings and errors will be written to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LimitationsParser

public LimitationsParser()
Creates a new limitations/rules parser.

Method Detail

parseFile

public RuleHolder parseFile(java.lang.String file_path,
                            java.lang.String block_name,
                            DescriptorList d_vector)
Parses the file given for the block name that is given and for the limitations information that is found in that block.

Parameters:
file_path - The path to the file to parse.
block_name - The filter block name, eg GROUND_FILTER
d_vector - The descriptor configs to use.
Returns:
RuleHolder containing any rules in the block.

parse

public static RuleHolder parse(VReader reader,
                               DescriptorConfigs dcfgs)
                        throws java.io.IOException
Parses the current block in the VReader for the limitations information that is found in that block.

Parameters:
reader - The VReader, pointing to the begin directive.
dcfgs - The descriptor configs to use.
Returns:
RuleHolder containing any rules in the block.
Throws:
java.io.IOException - if parsing the file fails for some reason

printError

public void printError(java.lang.String error)
The function that prints an error to the output stream.

Specified by:
printError in interface ErrorWriter
Parameters:
error - the error that will be printed
See Also:
ErrorWriter.printError(String message, int start, int stop)

printErrorAtLineNumber

public void printErrorAtLineNumber(java.lang.String error,
                                   int line_num)
The function that prints an error and a line number of the file in which the error has occured.

Specified by:
printErrorAtLineNumber in interface ErrorWriter
Parameters:
error - the error that will be printed
line_num - the line number

printError

public void printError(java.lang.String message,
                       int start,
                       int stop)
Description copied from interface: ErrorWriter
Print an error at a specific place inside the current line. Errors are something that prevents the file from being understood usefully.

Specified by:
printError in interface ErrorWriter
Parameters:
message - the message to print with the error
start - the column where the error begins
stop - the column where the error ends

printWarning

public void printWarning(java.lang.String message,
                         int start,
                         int stop)
Description copied from interface: ErrorWriter
Print an warning at a specific place inside the current line. A warning may make the parser generate an improper representation or otherwise misinterpret the data, but not necessarily.

Specified by:
printWarning in interface ErrorWriter
Parameters:
message - the message to print with the warning
start - the column where the questionable part begins
stop - the column where the questionable part ends

printErrorTotals

public void printErrorTotals()
The function that will print the total number of errors that occured in the file.

Specified by:
printErrorTotals in interface ErrorWriter

printGeneralError

public void printGeneralError(java.lang.String error)
The function that prints a general error to the output file.

Specified by:
printGeneralError in interface ErrorWriter
Parameters:
error - the error message

printWarning

public void printWarning(java.lang.String warning)
The function that print a warning message to the output file.

Specified by:
printWarning in interface ErrorWriter
Parameters:
warning - the warning message to be printed

printWarningAtLineNumber

public void printWarningAtLineNumber(java.lang.String warning,
                                     int line_num)
The function that prints a warning message and the line number that is attributed to this warning.

Specified by:
printWarningAtLineNumber in interface ErrorWriter
Parameters:
warning - the warning message to be printed
line_num - the line number that this error occured at

setOutput

public void setOutput(java.io.PrintWriter output)
Function that allows you to set a different output to which warnings and errors will be written to. By default, System.out (or the standard output ) will be used.

Specified by:
setOutput in interface ErrorWriter
Parameters:
output - the java.io.PrintWriter stream that you want errors to be written to.