Chris Rathman / ChrisRath@aol.com

/************************************************************************
 *                                                                      *
 * java.text                                                            *
 *                                                                      *
 *    Interfaces:                                                       *
 *       CharacterIterator                                              *
 *                                                                      *
 *    Classes:                                                          *
 *       BreakIterator                   FieldPosition                  *
 *       ChoiceFormat                    Format                         *
 *       CollationElementIterator        MessageFormat                  *
 *       CollationKey                    NumberFormat                   *
 *       Collator                        ParsePosition                  *
 *       DateFormat                      RuleBasedCollator              *
 *       DateFormatSymbols               SimpleDateFormat               *
 *       DecimalFormat                   StringCharacterIterator        *
 *       DecimalFormatSymbols                                           *
 *                                                                      *
 *    Exceptions:                                                       *
 *       ParseException                                                 *
 *                                                                      *
 ************************************************************************/
package Test.Chris;
import java.text.*;

public class Java_text {
   public void exercise() {
      dateformat();
      dateformatsymbols();
      simpledateformat();

      breakiterator();
      choiceformat();
      collationelementiterator();
      collationkey();
      collator();
      decimalformat();
      decimalformatsymbols();
      fieldposition();
      format();
      messageformat();
      numberformat();
      parseposition();
      rulebasedcollator();
      stringcharacteriterator();
   }

   /*********************************************************************
    *                                                                   *
    * DateFormat:                                                       *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       AM_PM_FIELD                      LONG                       *
    *       DATE_FIELD                       MEDIUM                     *
    *       DAY_OF_WEEK_FIELD                MILLISECOND_FIELD          *
    *       DAY_OF_WEEK_IN_MONTH_FIELD       MINUTE_FIELD               *
    *       DAY_OF_YEAR_FIELD                MONTH_FIELD                *
    *       DEFAULT                          SECOND_FIELD               *
    *       ERA_FIELD                        SHORT                      *
    *       FULL                             TIMEZONE_FIELD             *
    *       HOUR0_FIELD                      WEEK_OF_MONTH_FIELD        *
    *       HOUR1_FIELD                      WEEK_OF_YEAR_FIELD         *
    *       HOUR_OF_DAY0_FIELD               YEAR_FIELD                 *
    *       HOUR_OF_DAY1_FIELD                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getInstance          parseObject       *
    *       equals               getNumberFormat      setCalendar       *
    *       format               getTimeInstance      setLenient        *
    *       getAvailableLocales  getTimeZone          setNumberFormat   *
    *       getCalendar          hashCode             setTimeZone       *
    *       getDateInstance      isLenient                              *
    *       getDateTimeInstance  parse                                  *
    *                                                                   *
    *********************************************************************/
   void dateformat() {
      int i;
      boolean f;
      String s;
      StringBuffer sb;
      java.util.Locale[] lx;
      java.util.Calendar c;
      java.util.TimeZone tz;
      java.util.Date d;
      NumberFormat fn;
      FieldPosition fp;
      DateFormat df;
      DateFormat dy;

      df = DateFormat.getInstance();    // Get default date/time formatter that uses SHORT style for both

      df = DateFormat.getDateInstance();           // gets the date formatter
      df = DateFormat.getDateInstance(DateFormat.DEFAULT);
      df = DateFormat.getDateInstance(DateFormat.DEFAULT, java.util.Locale.US);

      df = DateFormat.getTimeInstance();           // gets the time formatter
      df = DateFormat.getTimeInstance(DateFormat.DEFAULT);
      df = DateFormat.getTimeInstance(DateFormat.DEFAULT, java.util.Locale.US);

      df = DateFormat.getDateTimeInstance();       // get the date/time formatter
      df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);
      df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, java.util.Locale.US);

      try {
         df = DateFormat.getDateInstance(DateFormat.SHORT);
         d = df.parse("9/30/98");
         s = df.format(d);
         df = DateFormat.getDateInstance(DateFormat.MEDIUM);
         d = df.parse("30-Sep-98");
         s = df.format(d);
         df = DateFormat.getDateInstance(DateFormat.DEFAULT);
         d = df.parse("30-Sep-98");
         s = df.format(d);
         df = DateFormat.getDateInstance(DateFormat.LONG);
         d = df.parse("September 30, 1998");
         s = df.format(d);
         df = DateFormat.getDateInstance(DateFormat.FULL);
         d = df.parse("Wednesday, September 30, 1998");
         s = df.format(d);

         df = DateFormat.getTimeInstance(DateFormat.SHORT);
         d = df.parse("10:45 PM");
         s = df.format(d);
         df = DateFormat.getTimeInstance(DateFormat.MEDIUM);
         d = df.parse("10:45:30 PM");
         s = df.format(d);
         df = DateFormat.getTimeInstance(DateFormat.DEFAULT);
         d = df.parse("10:45:30 PM");
         s = df.format(d);
         df = DateFormat.getTimeInstance(DateFormat.LONG);
         d = df.parse("10:45:30 PM CST");
         s = df.format(d);
         df = DateFormat.getTimeInstance(DateFormat.FULL);
         d = df.parse("10:45:30 o'clock PM CST");
         s = df.format(d);

         df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
         d = df.parse("9/30/98 10:45 PM");
         s = df.format(d);
         df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
         d = df.parse("30-Sep-98 10:45:30 PM");
         s = df.format(d);
         df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);
         d = df.parse("30-Sep-98 10:45:30 PM");
         s = df.format(d);
         df = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
         d = df.parse("September 30, 1998 10:45:30 PM CST");
         s = df.format(d);
         df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
         d = df.parse("Wednesday, September 30, 1998 22:45:30 o'clock PM CST");
         s = df.format(d);

      } catch(ParseException e) {
      }

      ParsePosition p = new ParsePosition(2);
      df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
      d = df.parse("XX9/30/98 10:45 PM", p);

      p = new ParsePosition(2);
      df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
      d = (java.util.Date)df.parseObject("XX9/30/98 10:45 PM", p);

      c = df.getCalendar();             // gets the calendar associated with this date/time formatter
      df.setCalendar(c);                // set the calendar to be used by this date format
      tz = df.getTimeZone();            // gets the time zone
      df.setTimeZone(tz);               // sets the time zone for the calendar of this DateFormat object
      lx = df.getAvailableLocales();    // gets the set of locales for which DateFormats are installed
      fn = df.getNumberFormat();        // gets the number formatter formatter used to format and parse a time
      df.setNumberFormat(fn);           // allows you to set the number formatter

      f = df.isLenient();               // tell whether date/time parsing is to be lenient
      df.setLenient(f);                 // specify whether or not date/time parsing is to be lenient

      dy = (DateFormat)df.clone();      // overrides Cloneable
      f = df.equals(dy);                // overrides equals
      i = df.hashCode();                // overrides hashCode

      df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);

      fp = new FieldPosition(DateFormat.ERA_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.YEAR_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.MONTH_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.DATE_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.HOUR_OF_DAY1_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.HOUR_OF_DAY0_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.MINUTE_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.SECOND_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.MILLISECOND_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.DAY_OF_WEEK_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.DAY_OF_YEAR_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.DAY_OF_WEEK_IN_MONTH_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.WEEK_OF_YEAR_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.WEEK_OF_MONTH_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.AM_PM_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.HOUR1_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.HOUR0_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(DateFormat.TIMEZONE_FIELD);
      sb = df.format(d, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());
   }

   /*********************************************************************
    *                                                                   *
    * SimpleDateFormat:                                                 *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       applyLocalizedPattern            hashCode                   *
    *       applyPattern                     parse                      *
    *       clone                            setDateFormatSymbols       *
    *       equals                           toLocalizedPattern         *
    *       format                           toPattern                  *
    *       getDateFormatSymbols                                        *
    *                                                                   *
    *                                                                   *
    *       Symbol    Meaning                  Example                  *
    *       ------    -------                  -------                  *
    *       G         era designator           AD                       *
    *       y         year                     1996                     *
    *       M         month in year            July & 07                *
    *       d         day in month             10                       *
    *       h         hour in am/pm (1~12)     12                       *
    *       H         hour in day (0~23)       0                        *
    *       m         minute in hour           30                       *
    *       s         second in minute         55                       *
    *       S         millisecond              978                      *
    *       E         day in week              Tuesday                  *
    *       D         day in year              189                      *
    *       F         day of week in month     2 (2nd Wed in July)      *
    *       w         week in year             27                       *
    *       W         week in month            2                        *
    *       a         am/pm marker             PM                       *
    *       k         hour in day (1~24)       24                       *
    *       K         hour in am/pm (0~11)     0                        *
    *       z         time zone                Pacific Standard Time    *
    *       '         escape for text                                   *
    *       ''        single quote             '                        *
    *                                                                   *
    *********************************************************************/
   void simpledateformat() {
      int i;
      boolean f;
      String s;
      java.util.Date d = new java.util.Date();
      DateFormatSymbols dfs;
      SimpleDateFormat sdf;
      SimpleDateFormat sdx;

      sdf = new SimpleDateFormat("yyyy.MM.dd 'at' hh:mm:ss a zzz");
      s = sdf.format(d);
      ParsePosition p = new ParsePosition(0);
      d = sdf.parse(s, p);              // overrides DateFormat

      s = sdf.toPattern();              // return a pattern string describing this date format
      sdf.applyPattern(s);              // apply the given unlocalized pattern string to this date format
      s = sdf.toLocalizedPattern();     // return a localized pattern string describing this date format
      sdf.applyLocalizedPattern(s);     // apply the given localized pattern string to this date format
      dfs = sdf.getDateFormatSymbols(); // gets the date/time formatting data
      sdf.setDateFormatSymbols(dfs);    // allows you to set the date/time formatting data

      sdx = (SimpleDateFormat)sdf.clone();
      f = sdf.equals(sdx);              // override equals
      i = sdf.hashCode();               // override hashCode
   }

   /*********************************************************************
    *                                                                   *
    * DateFormatSymbols:                                                *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getShortWeekdays     setMonths         *
    *       equals               getWeekdays          setShortMonths    *
    *       getAmPmStrings       getZoneStrings       setShortWeekdays  *
    *       getEras              hashCode             setWeekday        *
    *       getLocalPatternChars setAmPmStrings       setZoneStrings    *
    *       getMonths            setEras                                *
    *       getShortMonths       setLocalPatternChars                   *
    *                                                                   *
    *********************************************************************/
   void dateformatsymbols() {
      int i;
      boolean f;
      String s;
      String[] sx;
      String[][] sy;
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd 'at' hh:mm:ss a zzz");
      DateFormatSymbols dfs = new DateFormatSymbols();
      DateFormatSymbols dfx = sdf.getDateFormatSymbols();

      sx = dfs.getAmPmStrings();        // gets ampm strings
      dfs.setAmPmStrings(sx);           // sets ampm strings

      sx = dfs.getEras();               // gets era strings
      dfs.setEras(sx);                  // sets era strings

      s = dfs.getLocalPatternChars();   // gets localized date-time pattern characters
      dfs.setLocalPatternChars(s);      // sets localized date-time pattern characters

      sx = dfs.getMonths();             // gets month strings
      dfs.setMonths(sx);                // sets month strings

      sx = dfs.getShortMonths();        // gets short month strings
      dfs.setShortMonths(sx);           // sets short month strings

      sx = dfs.getShortWeekdays();      // gets short weekday strings
      dfs.setShortWeekdays(sx);         // sets short weekday strings

      sx = dfs.getWeekdays();           // gets weekday strings
      dfs.setWeekdays(sx);              // sets weekday strings

      sy = dfs.getZoneStrings();        // gets timezone strings
      dfs.setZoneStrings(sy);           // sets timezone strings

      dfx = (DateFormatSymbols)dfs.clone();  // overrides Cloneable
      f = dfs.equals(dfx);              // override equals
      i = dfs.hashCode();               // override hashCode
   }

   /*********************************************************************
    *                                                                   *
    * ParsePosition:                                                    *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       getIndex             setIndex                               *
    *                                                                   *
    *********************************************************************/
   void parseposition() {
      int i;
      ParsePosition p = new ParsePosition(0);

      i = p.getIndex();                 // retrieve the current parse position
      p.setIndex(0);                    // set the current parse position
   }

   /*********************************************************************
    *                                                                   *
    * FieldPosition:                                                    *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       getBeginIndex        getEndIndex          getField          *
    *                                                                   *
    *********************************************************************/
   void fieldposition() {
   /*
      getBeginIndex()                   // Retrieve the index of the first character in the requested field
      getEndIndex()                     // Retrieve the index of the character following the last character in the requested field
      getField()                        // Retrieve the field identifier
   */
   }

   /*********************************************************************
    *                                                                   *
    * NumberFormat:                                                     *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       FRACTION_FIELD       INTEGER_FIELD                          *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                            hashCode                   *
    *       equals                           isGroupingUsed             *
    *       format                           isParseIntegerOnly         *
    *       getAvailableLocales              parse                      *
    *       getCurrencyInstance              parseObject                *
    *       getInstance                      setGroupingUsed            *
    *       getMaximumFractionDigits         setMaximumFractionDigits   *
    *       getMaximumIntegerDigits          setMaximumIntegerDigits    *
    *       getMinimumFractionDigits         setMinimumFractionDigits   *
    *       getMinimumIntegerDigits          setMinimumIntegerDigits    *
    *       getNumberInstance                setParseIntegerOnly        *
    *       getPercentInstance                                          *
    *                                                                   *
    *********************************************************************/
   void numberformat() {
      int i;
      boolean f;
      String s;
      StringBuffer sb;
      java.util.Locale[] lx;
      FieldPosition fp;
      Number n;
      NumberFormat nf;
      NumberFormat nx;

      nf = NumberFormat.getInstance();                   // default number format for default locale
      nf = NumberFormat.getInstance(java.util.Locale.US);// default number format for specified locale
      s = nf.format(1.23);                               // specialization of format - double or long
      try {
         n = nf.parse("1.23");                           // convenience method
      } catch(ParseException e) {
      }

      nf = NumberFormat.getNumberInstance();             // general-purpose number format for default locale
      nf = NumberFormat.getNumberInstance(java.util.Locale.US);
      s = nf.format(1.23);
      try {
         n = nf.parse("1.23");
      } catch(ParseException e) {
      }

      nf = NumberFormat.getCurrencyInstance();           // currency format for default locale
      nf = NumberFormat.getCurrencyInstance(java.util.Locale.US);
      s = nf.format(1.23);
      try {
         n = nf.parse("$1.23");
      } catch(ParseException e) {
      }

      nf = NumberFormat.getPercentInstance();            // percentage format for default locale
      nf = NumberFormat.getPercentInstance(java.util.Locale.US);
      s = nf.format(1.23);
      try {
         n = nf.parse("123%");
      } catch(ParseException e) {
      }

      nf = NumberFormat.getInstance();
      n = nf.parse("XX1.23", new ParsePosition(2));
      n = (Number)nf.parseObject("XX1.23", new ParsePosition(2));

      fp = new FieldPosition(NumberFormat.INTEGER_FIELD);
      sb = nf.format(1.23, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      fp = new FieldPosition(NumberFormat.FRACTION_FIELD);
      sb = nf.format(1.23, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      i = nf.getMaximumFractionDigits();// returns max digits allowed in the fraction portion of a number
      nf.setMaximumFractionDigits(i);   // sets max digits allowed in the fraction portion of a number
      i = nf.getMaximumIntegerDigits(); // returns max digits allowed in the integer portion of a number
      nf.setMaximumIntegerDigits(i);    // sets max digits allowed in the integer portion of a number
      i = nf.getMinimumFractionDigits();// returns min digits allowed in the fraction portion of a number
      nf.setMinimumFractionDigits(i);   // sets min digits allowed in the fraction portion of a number
      i = nf.getMinimumIntegerDigits(); // returns min digits allowed in the integer portion of a number
      nf.setMinimumIntegerDigits(i);    // sets min digits allowed in the integer portion of a number

      f = nf.isGroupingUsed();          // returns true if grouping is used in this format
      nf.setGroupingUsed(f);            // set whether or not grouping will be used in this format
      f = nf.isParseIntegerOnly();      // returns true if this format will parse numbers as integers only
      nf.setParseIntegerOnly(f);        // sets whether or not numbers should be parsed as integers only

      lx = NumberFormat.getAvailableLocales();  // get set of Locales for which NumberFormats are installed

      nx = (NumberFormat)nf.clone();    // overrides Cloneable
      f = nf.equals(nx);                // overrides equals
      i = nf.hashCode();                // overrides hashCode
   }

   /*********************************************************************
    *                                                                   *
    * DecimalFormat:                                                    *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       applyLocalizedPattern         isDecimalSeparatorAlwaysShown *
    *       applyPattern                  parse                         *
    *       clone                         setDecimalFormatSymbols       *
    *       equals                        setDecimalSeparatorAlwaysShown*
    *       format                        setGroupingSize               *
    *       getDecimalFormatSymbols       setMultiplier                 *
    *       getGroupingSize               setNegativePrefix             *
    *       getMultiplier                 setNegativeSuffix             *
    *       getNegativePrefix             setPositivePrefix             *
    *       getNegativeSuffix             setPositiveSuffix             *
    *       getPositivePrefix             toLocalizedPattern            *
    *       getPositiveSuffix             toPattern                     *
    *       hashCode                                                    *
    *                                                                   *
    *       Symbol   Meaning                                            *
    *       ======   ================================================   *
    *       0        a digit                                            *
    *       #        a digit, zero shows as absent                      *
    *       .        placeholder for decimal separator                  *
    *       ,        placeholder for grouping separator.                *
    *       ;        separates formats.                                 *
    *       -        default negative prefix.                           *
    *       %        multiply by 100 and show as percentage             *
    *       ?        multiply by 1000 and show as per mille             *
    *               currency sign; replaced by currency symbol; if     *
    *                   doubled, replaced by international currency     *
    *                   symbol.  If present in a pattern, the monetary  *
    *                   decimal separator is used instead of the        *
    *                   decimal separator.                              *
    *        X      any other chars can be used in the prefix or suffix *
    *        '      used to quote special char in a prefix or suffix.   *
    *                                                                   *
    *********************************************************************/
   void decimalformat() {
      int i;
      boolean f;
      String s;
      StringBuffer sb;
      FieldPosition fp;
      Number n;
      DecimalFormatSymbols dfs;
      DecimalFormat df;
      DecimalFormat dx;

      df = new DecimalFormat();
      df = new DecimalFormat("0.00;-0.00");
      df = new DecimalFormat("0.00;-0.00", new DecimalFormatSymbols());
      s = df.format(1.23);
      n = df.parse("XX1.23", new ParsePosition(2));

      fp = new FieldPosition(0);
      sb = df.format(1.23, new StringBuffer(""), fp);
      s = sb.toString().substring(fp.getBeginIndex(), fp.getEndIndex());

      s = df.toPattern();               // synthesizes a pattern string
      df.applyPattern(s);               // apply the given pattern to this Format object
      s = df.toLocalizedPattern();      // synthesizes a localized pattern string
      df.applyLocalizedPattern(s);      // apply the given pattern to this Format object

      dfs = df.getDecimalFormatSymbols(); // returns the decimal format symbols
      df.setDecimalFormatSymbols(dfs);  // sets the decimal format symbols
      i = df.getGroupingSize();         // return the grouping size
      df.setGroupingSize(i);            // set grouping size
      i = df.getMultiplier();           // get multiplier for use in percent, permill, etc
      df.setMultiplier(i);              // set multiplier for use in percent, permill, etc
      s = df.getNegativePrefix();       // get negative prefix
      df.setNegativePrefix(s);          // set negative prefix
      s = df.getNegativeSuffix();       // get negative suffix
      df.setNegativeSuffix(s);          // set positive suffix
      s = df.getPositivePrefix();       // get positive prefix
      df.setPositivePrefix(s);          // set positive prefix
      s = df.getPositiveSuffix();       // get positive suffix
      df.setPositiveSuffix(s);          // set positive suffix
      f = df.isDecimalSeparatorAlwaysShown();   // get the behavior of the decimal separator with integers
      df.setDecimalSeparatorAlwaysShown(f);     // set the behavior of the decimal separator with integers

      dx = (DecimalFormat)df.clone();   // overrides Cloneable
      f = df.equals(dx);                // overrides equals
      i = df.hashCode();                // overrides hashCode
   }

   /*********************************************************************
    *                                                                   *
    * DecimalFormatSymbols:                                             *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getPatternSeparator setInfinity        *
    *       equals               getPercent          setMinusSign       *
    *       getDecimalSeparator  getPerMill          setNaN             *
    *       getDigit             getZeroDigit        setPatternSeparator*
    *       getGroupingSeparator hashCode            setPercent         *
    *       getInfinity          setDecimalSeparator setPerMill         *
    *       getMinusSign         setDigit            setZeroDigit       *
    *       getNaN               setGroupingSeparator                   *
    *                                                                   *
    *********************************************************************/
   void decimalformatsymbols() {
      boolean f;
      int i;
      char c;
      String s;
      DecimalFormat df = new DecimalFormat();
      DecimalFormatSymbols dfs;
      DecimalFormatSymbols dfx;

      dfs = df.getDecimalFormatSymbols();

      c = dfs.getDecimalSeparator();    // character used for decimal sign
      dfs.setDecimalSeparator(c);
      c = dfs.getDigit();               // character used for a digit in a pattern
      dfs.setDigit(c);
      c = dfs.getGroupingSeparator();   // character used for thousands separator
      dfs.setGroupingSeparator(c);
      s = dfs.getInfinity();            // character used to represent infinity
      dfs.setInfinity(s);
      c = dfs.getMinusSign();           // character used to represent minus sign
      dfs.setMinusSign(c);
      s = dfs.getNaN();                 // character used to represent NaN
      dfs.setNaN(s);
      c = dfs.getPatternSeparator();    // character used to separate positive and negative subpatterns
      dfs.setPatternSeparator(c);
      c = dfs.getPercent();             // character used for percent sign
      dfs.setPercent(c);
      c = dfs.getPerMill();             // character used for mille percent sign
      dfs.setPerMill(c);
      c = dfs.getZeroDigit();           // character used for zero
      dfs.setZeroDigit(c);

      dfx = (DecimalFormatSymbols)dfs.clone();   // overrides Cloneable
      f = dfs.equals(dfx);               // overrides equals
      i = dfs.hashCode();                // overrides hashCode
   }

   /*********************************************************************
    *                                                                   *
    * ChoiceFormat:                                                     *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       applyPattern         getFormats           parse             *
    *       clone                getLimits            previousDouble    *
    *       equals               hashCode             setChoices        *
    *       format               nextDouble           toPattern         *
    *                                                                   *
    *********************************************************************/
   void choiceformat() {
      int i;
      boolean f;
      String s;
      StringBuffer sb;
      Number n;
      double x;
      double[] dx = {0, 20, 40};
      String[] sx = {"small", "medium", "large"};
      ChoiceFormat cf;
      ChoiceFormat cx;

      cf = new ChoiceFormat(dx, sx);
      cf = new ChoiceFormat("0#small|20#medium|40#large");

      s = cf.format(10);
      sb = cf.format(25, new StringBuffer(""), new FieldPosition(0));

      n = cf.parse("XXmedium", new ParsePosition(2));

      cf.setChoices(dx, sx);            // set the choices to be used in formatting
      s = cf.toPattern();               // gets the pattern
      cf.applyPattern(s);               // sets the pattern

      dx = (double[])cf.getLimits();    // get the limits passed in the constructor
      for (i = 0; i < dx.length; i++) {
         x = dx[i];
      }
      sx = (String[])cf.getFormats();   // get the formats passed in the constructor
      for (i = 0; i < sx.length; i++) {
         s = sx[i];
      }

      x = cf.nextDouble(20.0);          // finds the least double greater than d
      x = cf.nextDouble(20.0, false);   // true=increment; false=decrement
      x = cf.previousDouble(20.0);      // finds the greatest double less than d

      cx = (ChoiceFormat)cf.clone();    // overrides Cloneable
      f = cf.equals(cx);                // overrides equals
      i = cf.hashCode();                // overrides hashCode
   }

   /*********************************************************************
    *                                                                   *
    * MessageFormat:                                                    *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       applyPattern         getLocale            setFormats        *
    *       clone                hashCode             setLocale         *
    *       equals               parse                toPattern         *
    *       format               parseObject                            *
    *       getFormats           setFormat                              *
    *                                                                   *
    *       Format      Modifiers                                       *
    *       ======      =========                                       *
    *       time        short | medium | long | full                    *
    *       date        short | medium | long | full                    *
    *       number      integer | currency | percent                    *
    *       choice      choiceFormatPattern                             *
    *                                                                   *
    *********************************************************************/
   void messageformat() {
      int i;
      boolean f;
      String s;
      StringBuffer sb;
      java.util.Locale l;
      Format fmt;
      Format[] fx;
      Object[] args = {"Chris", new Integer(5), new java.util.Date()};
      MessageFormat mf;
      MessageFormat mx;

      mf = new MessageFormat("{0} has {1} Message(s)");
      s = mf.format(args);
      sb = mf.format(args, new StringBuffer(""), new FieldPosition(0));
      s = MessageFormat.format("{0} has {1} Message(s)", args);

      s = "{0} has {1, number, integer} Message{1, choice, 0#s|1#|2#s}. {2, date, short} {2, time, short}";
      mf = new MessageFormat(s);
      s = mf.format(args);

      s = mf.toPattern();               // gets the pattern
      mf.applyPattern(s);               // sets the pattern

      fx = mf.getFormats();              // gets formats that were set with setFormats
      for (i = 0; i < fx.length; i++) {
         fmt = fx[i];
      }
      mf.setFormat(1, fx[1]);           // sets formats individually to use on parameters
      mf.setFormats(fx);                // sets formats to use on parameters

      l = mf.getLocale();               // gets the locale
      mf.setLocale(l);                  // constructs with the specified locale

      mf = new MessageFormat("Chris has {0} Message(s).");
      try {
         args = mf.parse("Chris has 1 Message(s).");
      } catch(ParseException e) {
      }
      args = mf.parse("Chris has 1 Message(s).", new ParsePosition(0));
      args[0] = mf.parseObject("Chris has 1 Message(s).", new ParsePosition(0));

      mx = (MessageFormat)mf.clone();   // overrides Cloneable
      f = mf.equals(mx);                // overrides equals
      i = mf.hashCode();                // overrides hashCode
   }

   /*********************************************************************
    *                                                                   *
    * Format:                                                           *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                format               parseObject       *
    *                                                                   *
    *********************************************************************/
   void format() {
   /*
      clone()                           // Creates a new object of the same class as this object
      format(Object)                    // Formats an object to produce a string
      format(Object, StringBuffer, FieldPosition)   // Formats an object to produce a string
      parseObject(String)               // Parses a string to produce an object
      parseObject(String, ParsePosition)// Parses a string to produce an object
   */
   }

   /*********************************************************************
    *                                                                   *
    * BreakIterator:                                                    *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Vars:                                                          *
    *       DONE                                                        *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getCharacterInstance last              *
    *       current              getLineInstance      next              *
    *       first                getSentenceInstance  previous          *
    *       following            getText              setText           *
    *       getAvailableLocales  getWordInstance                        *
    *                                                                   *
    *********************************************************************/
   void breakiterator() {
   /*
      DONE                              // DONE is returned by previous() and next() after all valid boundaries have been returned

      clone()                           // Create a copy of this iterator
      current()                         // Return character index of the text boundary that was most recently returned by next(), previous(), first(), or last()
      first()                           // Return the first boundary
      following(int)                    // Return the first boundary following the specified offset
      getAvailableLocales()             // Get the set of Locales for which BreakIterators are installed
      getCharacterInstance()            // Create BreakIterator for character-breaks using default locale Returns an instance of a BreakIterator implementing character breaks
      getCharacterInstance(Locale)      // Create BreakIterator for character-breaks using specified locale Returns an instance of a BreakIterator implementing character breaks
      getLineInstance()                 // Create BreakIterator for line-breaks using default locale
      getLineInstance(Locale)           // Create BreakIterator for line-breaks using specfied locale
      getSentenceInstance()             // Create BreakIterator for sentence-breaks using default locale Returns an instance of a BreakIterator implementing sentence breaks
      getSentenceInstance(Locale)       // Create BreakIterator for sentence-breaks using specified locale Returns an instance of a BreakIterator implementing sentence breaks
      getText()                         // Get the text being scanned
      getWordInstance()                 // Create BreakIterator for word-breaks using default locale
      getWordInstance(Locale)           // Create BreakIterator for word-breaks using specified locale
      last()                            // Return the last boundary
      next()                            // Return the boundary following the current boundary
      next(int)                         // Return the nth boundary from the current boundary
      previous()                        // Return the boundary preceding the current boundary
      setText(CharacterIterator)        // Set a new text for scanning
      setText(String)                   // Set a new text string to be scanned
   */
   }

   /*********************************************************************
    *                                                                   *
    * CollationElementIterator:                                         *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Vars:                                                          *
    *       NULLORDER                                                   *
    *                                                                   *
    *    Methods:                                                       *
    *       next                 reset                tertiaryOrder     *
    *       primaryOrder         secondaryOrder                         *
    *                                                                   *
    *********************************************************************/
   void collationelementiterator() {
   /*
      NULLORDER                         // Null order which indicates the end of string is reached by the cursor

      next()                            // Get the ordering priority of the next character in the string
      primaryOrder(int)                 // Get the primary order of a collation order
      reset()                           // Resets the cursor to the beginning of the string
      secondaryOrder(int)               // Get the secondary order of a collation order
      tertiaryOrder(int)                // Get the tertiary order of a collation order
   */
   }

   /*********************************************************************
    *                                                                   *
    * CollationKey:                                                     *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       compareTo            getSourceString      toByteArray       *
    *       equals               hashCode                               *
    *                                                                   *
    *********************************************************************/
   void collationkey() {
   /*
      compareTo(CollationKey)           // Compare this CollationKey to the target CollationKey
      equals(Object)                    // Compare this CollationKey and the target CollationKey for equality
      getSourceString()                 // Returns the String that this CollationKey represents
      hashCode()                        // Creates a hash code for this CollationKey
      toByteArray()                     // Converts the CollationKey to a sequence of bits
   */
   }

   /*********************************************************************
    *                                                                   *
    * Collator:                                                         *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Vars:                                                          *
    *       CANONICAL_DECOMPOSITION          PRIMARY                    *
    *       FULL_DECOMPOSITION               SECONDARY                  *
    *       IDENTICAL                        TERTIARY                   *
    *       NO_DECOMPOSITION                                            *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getCollationKey      hashCode          *
    *       compare              getDecomposition     setDecomposition  *
    *       equals               getInstance          setStrength       *
    *       getAvailableLocales  getStrength                            *
    *                                                                   *
    *********************************************************************/
   void collator() {
   /*
      CANONICAL_DECOMPOSITION           // Decomposition mode value
      FULL_DECOMPOSITION                // Decomposition mode value
      IDENTICAL                         // Collator strength value
      NO_DECOMPOSITION                  // Decomposition mode value
      PRIMARY                           // Collator strength value
      SECONDARY                         // Collator strength value
      TERTIARY                          // Collator strength value

      clone()                           // Overrides Cloneable
      compare(String, String)           // Compares the source string to the target string according to the collation rules for this Collator
      equals(Object)                    // Compares the equality of two Collators
      equals(String, String)            // Convenience method for comparing the equality of two strings based on this Collator's collation rules
      getAvailableLocales()             // Get the set of Locales for which Collators are installed
      getCollationKey(String)           // Transforms the String into a series of bits that can be compared bitwise to other CollationKeys
      getDecomposition()                // Get the decomposition mode of this Collator
      getInstance()                     // Gets the Collator for the current default locale
      getInstance(Locale)               // Gets the Collator for the desired locale
      getStrength()                     // Returns this Collator's strength property
      hashCode()                        // Generates the hash code for this Collator
      setDecomposition(int)             // Set the decomposition mode of this Collator
      setStrength(int)                  // Sets this Collator's strength property
   */
   }

   /*********************************************************************
    *                                                                   *
    * RuleBasedCollator:                                                *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                            getCollationKey            *
    *       compare                          getRules                   *
    *       equals                           hashCode                   *
    *       getCollationElementIterator                                 *
    *                                                                   *
    *********************************************************************/
   void rulebasedcollator() {
   /*
      clone()                           // Standard override; no change in semantics
      compare(String, String)           // Compares the character data stored in two different strings based on the collation rules
      equals(Object)                    // Compares the equality of two collation objects
      getCollationElementIterator(String)   // Return a CollationElementIterator for the given String
      getCollationKey(String)           // Transforms the string into a series of characters that can be compared with CollationKey.compareTo
      getRules()                        // Gets the table-based rules for the collation object
      hashCode()                        // Generates the hash code for the table-based collation object
   */
   }

   /*********************************************************************
    *                                                                   *
    * StringCharacterIterator:                                          *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getBeginIndex        last              *
    *       current              getEndIndex          next              *
    *       equals               getIndex             previous          *
    *       first                hashCode             setIndex          *
    *                                                                   *
    *********************************************************************/
   void stringcharacteriterator() {
   /*
      clone()                           // Create a copy of this boundary
      current()                         // Get the character at the current position (as returned by getIndex())
      equals(Object)                    // Compares the equality of two StringCharacterIterator objects
      first()                           // Set the position to getBeginIndex() and return the character at that position
      getBeginIndex()                   // Return the start index of the text
      getEndIndex()                     // Return the end index of the text
      getIndex()                        // Return the current index
      hashCode()                        // Compute a hashcode for this enumeration
      last()                            // Set the position to getEndIndex() and return the character at that position
      next()                            // Increment the iterator's index by one and return the character at the new index
      previous()                        // Decrement the iterator's index by one and return the character at the new index
      setIndex(int)                     // Set the position to specified position in the text and return that character
   */
   }

   /*********************************************************************
    *                                                                   *
    * CharacterIterator Interface:                                      *
    *                                                                   *
    *    Desc:    x                                                     *
    *                                                                   *
    *    Vars:                                                          *
    *       DONE                                                        *
    *                                                                   *
    *    Methods:                                                       *
    *       clone                getEndIndex          previous          *
    *       current              getIndex             setIndex          *
    *       first                last                                   *
    *       getBeginIndex        next                                   *
    *                                                                   *
    *********************************************************************/
   void characteriterator() {
   /*
      DONE                              // Constant that is returned when the iterator has reached either the end or the beginning of the text

      clone()                           // Create a copy of this iterator
      current()                         // Get the character at the current position (as returned by getIndex())
      first()                           // Set the position to getBeginIndex() and return the character at that position
      getBeginIndex()                   // Return the start index of the text
      getEndIndex()                     // Return the end index of the text
      getIndex()                        // Return the current index
      last()                            // Set the position to getEndIndex()-1, return the character at that position
      next()                            // Increment the iterator's index by one and return the character at the new index
      previous()                        // Decrement the iterator's index by one and return the character at the new index
      setIndex(int)                     // Set the position to the specified position in the text and return that character
   */
   }
}

Chris Rathman / ChrisRath@aol.com