xbn.string.escape
Class ESConfig

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.string.escape.ESConfig
Direct Known Subclasses:
USConfig

public class ESConfig
extends XBNObject

Configuration for EscapeString. See EscapeString.

Source code:  ESConfig.java


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
ESConfig()
          Create an ESConfig with default values.
ESConfig(char c_escape)
          Create an ESConfig.
ESConfig(char[] ac_toEscape)
          Create an ESConfig.
ESConfig(char c_escape, char[] ac_toEscape)
          Create an ESConfig.
ESConfig(ESConfig es_config)
          Create a full (deep) copy of the provided ESConfig.
 
Method Summary
 APChar getAPCToEscape()
          Get the array of chars that must be escaped by getEscapeChar, as an APChar.
 char getEscapeChar()
          Get the escape character.
 String getEscapeCharAsString()
          Get the escape character, translated to a string.
static char getEscapeCharDefault()
          When none is provided, what is the escape character used by default?
 boolean isToBeEscaped(char c_har)
          Is the provided character one that should be escaped?
 String toString()
          Get some information about this ESConfig.
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ESConfig

public ESConfig()

Create an ESConfig with default values.

Equal to ESConfig(getEscapeCharDefault())


ESConfig

public ESConfig(char c_escape)

Create an ESConfig.

Equal to ESConfig(c_escape, (new char[] {}))


ESConfig

public ESConfig(char[] ac_toEscape)

Create an ESConfig.

Equal to ESConfig(getEscapeCharDefault(), ac_toEscape)


ESConfig

public ESConfig(char c_escape,
                char[] ac_toEscape)

Create an ESConfig.

Parameters:
c_escape - The escape character.
ac_toEscape - The array of charcters that can be escaped by c_escape (in addition to c_escape). Must be non-null. If at least one element in length, it must be ordered ascending, and its elements must be unique and not equal to c_escape. If zero elements in length, then c_escape may only escape itself.

ESConfig

public ESConfig(ESConfig es_config)

Create a full (deep) copy of the provided ESConfig.

Parameters:
es_config - The ESConfig to copy. May not be null.
Method Detail

getEscapeChar

public final char getEscapeChar()

Get the escape character.

Returns:
c_escape Exactly as provided to the constructor.

getEscapeCharAsString

public final String getEscapeCharAsString()

Get the escape character, translated to a string.

Returns:
(new Character(c_escape)).toString() Where c_escape is exactly as provided to the constructor. Note: This translation only happens once, in the constructor.

getAPCToEscape

public final APChar getAPCToEscape()

Get the array of chars that must be escaped by getEscapeChar, as an APChar.

Returns:
(new APChar(ac_toEscape)) Where ac_toEscape is exactly as provided to the constructor. Note that the APChar object is only created once.

isToBeEscaped

public final boolean isToBeEscaped(char c_har)

Is the provided character one that should be escaped?

Returns:
(Arrays.binarySearch(ac_toEscape, c_har) > -1), where ac_toEscape is exactly as provided to the constructor.

toString

public String toString()

Get some information about this ESConfig.

Overrides:
toString in class Object

getEscapeCharDefault

public static final char getEscapeCharDefault()

When none is provided, what is the escape character used by default?

Returns:
'\\'



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo