// A class that provides seven constants to represent the days of the week.
// Barry Cornelius, 19 June 2000
public class Day
{
   public static final int monday    = 1;
   public static final int tuesday   = 2;
   public static final int wednesday = 3;
   public static final int thursday  = 4;
   public static final int friday    = 5;
   public static final int saturday  = 6;
   public static final int sunday    = 7;
   public static int getInstance(final String pString)
   {
      int tDayNumber = -1;
      if (pString.length()>1)
      {
         final String tLowerCaseString = pString.toLowerCase();
         switch (tLowerCaseString.charAt(0))
         {
            case 'm': { tDayNumber = monday;    } break;
            case 'w': { tDayNumber = wednesday; } break;
            case 'f': { tDayNumber = friday;    } break;
            case 't':
            {
               switch (tLowerCaseString.charAt(1))
               {
                  case 'u': { tDayNumber = tuesday;   } break;
                  case 'h': { tDayNumber = thursday;  } break;
               }
            }
            break;
            case 's':
            {
               switch (tLowerCaseString.charAt(1))
               {
                  case 'a': { tDayNumber = saturday;  } break;
                  case 'u': { tDayNumber = sunday;    } break;
               }
            }
            break;
         }
      }
      return tDayNumber;
   } //BJCHEREFIRST
   public static String getString(final int pInt)
   {
      switch (pInt)
      {
         case    monday:  { return "Monday";    }
         case   tuesday:  { return "Tuesday";   }
         case wednesday:  { return "Wednesday"; }
         case  thursday:  { return "Thursday";  }
         case    friday:  { return "Friday";    }
         case  saturday:  { return "Saturday";  }
         case    sunday:  { return "Sunday";    }
                default:  { return "Unknown";   }
      }
   }
}
