/* XBN Java: Generically useful, non-GUI Java code. http://sourceforge.net/projects/xbnjava Copyright (C) 1997-2003, Jeff Epstein All rights reserved. Modifications: No Redistribution in binary form, with or without modifications, are permitted provided that the following conditions are met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * If modifications are made to source code then this license should indicate that fact in the "Modifications" section above. * Neither the author, nor the contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [NOTE: This license contains NO advertising clause.] */ package xbn.template; import xbn.XBNObject; /**

Configuration for a Template.

Source code:  GapConfig.java.

@version 0.9b @author Jeff Epstein, http://sourceforge.net/projects/xbnjava. **/ public class GapConfig extends XBNObject { private char cTagDelimiter = ' '; private String sTagTextStart = null; private String sTagTextEnd = null; private char cEscape = ' '; /**

Create an GapConfig with default settings.

Equal to GapConfig(TConfigDefaults.getTagDelimiter())

**/ public GapConfig() { this(TConfigDefaults.getTagDelimiter()); } /**

Create an GapConfig.

Equal to GapConfig(c_tagDelimiter, '\\')

**/ public GapConfig(char c_tagDelimiter) { this(c_tagDelimiter, '\\'); } /**

Create an GapConfig.

Equal to GapConfig(TConfigDefaults.getTagDelimiter(), s_tagTextStart, s_tagTextEnd)

**/ public GapConfig(String s_tagTextStart, String s_tagTextEnd) { this(TConfigDefaults.getTagDelimiter(), s_tagTextStart, s_tagTextEnd); } /**

Create an GapConfig.

Equal to GapConfig(c_tagDelimiter, TConfigDefaults.getTagTxtStart(), TConfigDefaults.getTagTxtEnd(), c_escape)

**/ public GapConfig(char c_tagDelimiter, char c_escape) { this(c_tagDelimiter, TConfigDefaults.getTagTxtStart(), TConfigDefaults.getTagTxtEnd(), c_escape); } /**

Create an GapConfig.

Equal to GapConfig(TConfigDefaults.getTagDelimiter(), s_tagTextStart, s_tagTextEnd, , c_escape)

**/ public GapConfig(String s_tagTextStart, String s_tagTextEnd, char c_escape) { this(TConfigDefaults.getTagDelimiter(), s_tagTextStart, s_tagTextEnd, c_escape); } /**

Create an GapConfig.

Equal to GapConfig(c_tagDelimiter, s_tagTextStart, s_tagTextEnd, '\\')

**/ public GapConfig(char c_tagDelimiter, String s_tagTextStart, String s_tagTextEnd) { this(c_tagDelimiter, s_tagTextStart, s_tagTextEnd, '\\'); } /**

Create an GapConfig.

@param c_tagDelimiter The tag delimiter character. A single copy of this character precedes and follows both the tag start and end texts, to form a full gap tag part. May not equal c_escape. @param s_tagTextStart The text for the gap start tag. The entire start tag is considered to be a tag delimiter character, the value of this parameter, and then another tag delimiter character. Must be valid according to UtilTemplategetTag, and different than s_tagTextEnd. VALIDATED IN TLAObjects constructor. @param s_tagTextEnd The text for the gap end tag. Has the same rules as s_tagTextStart, and this parameter must have a different value than it. VALIDATED IN TLAObjects constructor. @param c_escape The escape character, to display a c_tagDelimiter literally. May not equal c_tagDelimiter. **/ public GapConfig(char c_tagDelimiter, String s_tagTextStart, String s_tagTextEnd, char c_escape) { if(c_tagDelimiter == c_escape) { throwAX("constructor: c_tagDelimiter equals c_escape. Currently '" + c_tagDelimiter + "'."); } cTagDelimiter = c_tagDelimiter; sTagTextStart = s_tagTextStart; sTagTextEnd = s_tagTextEnd; cEscape = c_escape; } /**

Get the character delimiter that starts and ends all tag parts.

To display a tag delimiter literally, precede it by the escape character.

@return c_tagDelimiter Exactly as provided to the constructor. **/ public final char getTagDelimiter() { return cTagDelimiter; } /**

Get the text for the gap start tag.

@return s_tagTextStart, exactly as provided to the constructor. **/ public final String getTagTextStart() { return sTagTextStart; } /**

Get the text for the gap end tag.

@return s_tagTextEnd, as provided to the constructor. **/ public final String getTagTextEnd() { return sTagTextEnd; } /**

Get the escape character.

To display a tag delimiter literally, precede it by the escape character.

@return c_escape Exactly as provided to the constructor. **/ public final char getEscapeChar() { return cEscape; } /**

Get some information about this GapConfig.

**/ public String toString() { return this.getClass().getName() + ": getTagDelimiter()='" + getTagDelimiter() + "', getTagTextStart()='" + getTagTextStart() + "', getTagTextEnd()='" + getTagTextEnd() + "', getEscapeChar()='" + getEscapeChar() + "'"; } }