/**
 * This class is a cross-browser <code>StringBuffer</code>, as in Java(tm).  <br>
 * The dominant versions of Firefox and Opera (versions 1.x and up) have fixed the string concatenation 
 * problem with the <code>+</code> and <code>+=</code> operator that
 * has plagued Internet Explorer v6 and less (and perhaps v7), and Mozilla web browsers 
 * (including Netscape 7 and below).  The string concatenation problem is very severe on these browsers.
 * This StringBuffer class provides string concatenation on Firefox and Opera that comes very close to their
 * native performance, while giving a performance boost of about six-fold to Internet Explorer, plus 
 * more gains in overall JavaScript application speed by avoiding unnecessary memory allocation.
 * Testing results show that this class strikes an optimal balance, in a single class, between optimizing String 
 * concatenation for Internet Explorer/some other web browsers and delivering the extra-fast performance 
 * offered by Firefox and Opera.
 * <br><br>
 * Please note that this class is highly optimized for execution speed.  Take great care before altering its code.
 * <br><br>
 * <a href="mailto:ehudsons@andrew.cmu.edu">Ellen Hudson-Snyder</a>, 
 * <a href="mailto:evedar@andrew.cmu.edu">Elvin Vedar</a>,
 * <a href="mailto:cbalz@andrew.cmu.edu">Christopher M. Balz</a>.
 * <br><br>CVS Version Info:<br>
 *  $Id: StringBuffer.js,v 1.5 2005/12/27 01:05:54 cbalz Exp $   
 * <br><br>
 * @inherits-from <code>AbstractStringBuffer</code>  
 * @object-prop <code>string</code> <code>strS</code>  A string to be concatenated with the <code>+=</code> operator.
 * @object-prop  <code>string</code> <code>arrStrings</code> An array to be concatenated into a string (workaround for browsers that
 *                                  have problems efficiently executing the <code>+=</code> operator.
 * @author Team GigaToasted (Fall-2005-CMU-NASA/Google-Practicum Subteam) 
 * @version 1.0
 * <br><br>
 */


StringBuffer.prototype = new AbstractStringBuffer();


/**
 * Create a <code>StringBuffer</code> class, switching 
 * methods depending if we are running in an environment
 * that does not execute the <code>+=</code> operator efficiently.
 */
function StringBuffer() {
    if (this.booIsFixed) {
      this.strS = "";
      this.append = StringBuffer_appendPlusEq;
      this.toString = StringBuffer_toStringPlusEq;
    } else {
      this.arrStrings = [];
    }
}


/**
 * This method appends to the string with the <code>+=</code> operator.
 * @param pArrStrings  <code>Array</code> An array containing the string or strings to append.
 */
function StringBuffer_appendPlusEq( pArrStrings ) {
    this.strS += pArrStrings.join( "" );
}


/**
 * This method returns a string that was 
 * concatenated with the <code>+=</code> operator.
 * @return <code>string</code> The concatenated string.
 */
function StringBuffer_toStringPlusEq() {
      return this.strS;
};

