admin
Class RequirementParser

java.lang.Object
  |
  +--admin.RequirementParser

public class RequirementParser
extends java.lang.Object

In the add modify module, the requirement strings the user builds are not in the native format stored in the SAS database. This class acts as the bridge between the two formats, allowing convienient conversion between the two formats. The format used in the database is referred to as database format, and the format used in displaying the requirement to the user is referred to as display format. Database format looks something like "1|(4#5)|^06" and display format looks something like "CSC 175N or ( MTH 072A xor MTH 073A ) or all PHY".


Constructor Summary
RequirementParser()
           
 
Method Summary
static java.lang.String toCourseDatabaseString(java.lang.String in)
          Converts a String in display format to database format.
static java.lang.String toCourseDisplayString(java.lang.String in)
          Converts a String in database format to display format.
static java.lang.String toMajorDatabaseString(java.lang.String in)
          Converts a String in display format to database format.
static java.lang.String toMajorDisplayString(java.lang.String in)
          Converts a String in database format to display format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequirementParser

public RequirementParser()
Method Detail

toCourseDisplayString

public static java.lang.String toCourseDisplayString(java.lang.String in)
                                              throws java.sql.SQLException
Converts a String in database format to display format. The numbers are assumed to be course ids and disicpline ids (if a carrot appears in front).

Parameters:
in - a String in database format
Returns:
A String in display format semantically equal to the parameter string.
Throws:
java.sql.SQLException - If an error occured while connecting to the SAS database.

toCourseDatabaseString

public static java.lang.String toCourseDatabaseString(java.lang.String in)
                                               throws java.sql.SQLException
Converts a String in display format to database format. The word tokens not acting as operators are expected to be course codes and disciplines codes.

Parameters:
in - A String in display format.
Returns:
A String in database format semantically equal to the string passed in.
Throws:
java.sql.SQLException - if an error occurs while connecting to the SAS database.

toMajorDisplayString

public static java.lang.String toMajorDisplayString(java.lang.String in)
                                             throws java.sql.SQLException
Converts a String in database format to display format. The numbers are expected to be major ids. Carrot notation is not allowed (or even meaningful) in these Strings.

Parameters:
in - A String in database format.
Returns:
A String in display format semantically equal to the string passed in.
Throws:
java.sql.SQLException - if an error occurs while connecting to the SAS database.

toMajorDatabaseString

public static java.lang.String toMajorDatabaseString(java.lang.String in)
                                              throws java.sql.SQLException
Converts a String in display format to database format. The word tokens not acting as operators are expected to be major codes.

Parameters:
in - A String in display format.
Returns:
A String in database format semantically equal to the string passed in.
Throws:
java.sql.SQLException - if an error occurs while connecting to the SAS database.