org.vishia.util
Class StringPart

java.lang.Object
  extended by org.vishia.util.StringPart
Direct Known Subclasses:
StringPartFromFile, StringPartFromFileLines

public class StringPart
extends java.lang.Object

The StringPart class represents a flexible valid part of a character string which spread is changeable. This is a enhancement of the standard class String or StringBuffer.
The StringPart class is associated to a String. Additionaly 4 Parameters determine the actual part of the String and the limits of changing this actual part. The followed image is used to explain the spreadness of the parts:

 abcdefghijklmnopqrstuvwxyz  Sample of the whole associated String
   =====================     The === indicates the maximal part
     -----------             The --- indicates the valid part before some operation
           +++++             The +++ indicates the valid part after some operation
      
At a first idea a part is likely a substring. But the actual part of the string is changeable, without building a new substring. So some operations of seeking and scanning are supported. The collectivity methods to scan strings from a file (Reader) are supported from a derivated class StringScan of this class.
Types of Methods:


Field Summary
protected  boolean bCurrentOk
          false if current scanning is not match
(package private)  boolean bFound
          True if the last operation of lento__(), seek etc. has found anything.
protected  int bitMode
          Some mode bits
protected  boolean bStartScan
          If true, than all idxLastScanned... are set to 0, it is after scanOk() or after scanStart()
static char cEndOfText
          The char used to code end of text.
(package private)  java.lang.String content
          The referenced string
static char cStartOfText
          The char used to code start of text.
protected  int end
          The actual exclusive end position of the valid part.
protected  int endLast
          Borders of the last part before calling of scan__(), seek__(), lento__().
protected  int endMax
          The rightest possible exclusive end position.
private  int idxLastFloatNumber
          current index of the last scanned float number. -1=nothing scanned. 0..4=valid
private  int idxLastIntegerNumber
          current index of the last scanned integer number. -1=nothing scanned. 0..4=valid
private static int mSeekBackward_
          Flag bit to force seeking backward.
private static int mSeekToLeft_
          Flag bit to force seeking left from start (Backward).
protected static int mSkipOverCommentInsideText_mode
          Bit in mode.
protected static int mSkipOverCommentToEol_mode
          Bit in mode.
protected static int mSkipOverWhitespace_mode
          Bit in mode.
protected  double[] nLastFloatNumber
          Last scanned float number
protected  long[] nLastIntegerNumber
          Last scanned integer number.
protected  int nLineCt
          The line number, counted by founded \n
(package private)  java.lang.String sCommentEnd
          The string defined the end of comment inside a text.
(package private)  java.lang.String sCommentStart
          The string defined the start of comment inside a text.
(package private)  java.lang.String sCommentToEol
          The string defined the start of comment to end of line
static int seekBack
          Flag to force seeking backward from the end position.
static int seekEnd
          Flag to force setting the start position after the seeking string.
static int seekNormal
          Flag to force seeking forward.
static int seekToLeft
          Flag to force seeking backward from the start position.
protected  java.lang.String sLastString
          Last scanned string.
protected  int start
          The actual start position of the valid part.
protected  int startLast
          Borders of the last part before calling of scan__(), seek__(), lento__().
protected  int startMin
          The leftest possible start position.
protected  int startScan
          Position of scanStart() or after scanOk() as start of next scan operations.
 
Constructor Summary
StringPart()
          Creates a new empty StringPart without an associated String.
StringPart(java.lang.String content)
          Creates a new StringPart, with the given content from a String.
StringPart(StringPart src)
          Creates a new StringPart with the same String as the given StringPart.
 
Method Summary
 StringPart assign(java.lang.String content)
          Sets the content to the given string, forgets the old content.
 StringPart assign(StringPart src)
          Sets the StringPart with the same String object as the given StringPart, forgets the old content.
 StringPart assignFromEnd(StringPart src)
          Sets the content of the StringPart , forgets the old content.
 java.lang.String debugString()
          Returns a debug information of the content of the StringPart.
 boolean equals(java.lang.String sCmp)
          Compares the Part of string with the given string
 boolean found()
          Returns true, if the last called seek__(), lento__() or skipWhitespaceAndComment() operation founds the requested condition.
 StringPart fromEnd()
          Sets the start of the part to the exclusively end, set the end to the end of the content.
private  java.lang.String getCircumScriptionToAnyChar_p(java.lang.String sCharsEnd, boolean bOutsideQuotion)
           
 java.lang.String getCircumScriptionToAnyChar(java.lang.String sCharsEnd)
          Gets a String with translitaration.
 java.lang.String getCircumScriptionToAnyCharOutsideQuotion(java.lang.String sCharsEnd)
           
 java.lang.String getCurrent(int nChars)
          Gets the next chars from current Position.
 char getCurrentChar()
          Gets the next char at current Position.
 int getCurrentColumn()
          Gets the current position in line (column of the text).
 java.lang.String getCurrentPart()
          Returns the actual part of the string.
 java.lang.String getCurrentPart(int maxLength)
          Returns the actual part of the string.
 long getCurrentPosition()
          Gets the current position, useable for rewind.
 java.lang.String getLastPart()
          Returns the last part of the string before any seek or scan operation.
 double getLastScannedFloatNumber()
          Returns the last scanned float number.
 long getLastScannedIntegerNumber()
          Returns the last scanned integer number.
 java.lang.String getLastScannedString()
           
 int getLen()
          Deprecated.  
 int getLineCt()
          get the Line ct
 int indexEndOfQuotion(char cEndQuotion, int fromWhere, int maxToTest)
          Searches the end of a quotion string.
 int indexOf(char ch)
          Returns the position of the char within the part, returns -1 if the char is not found in the part.
 int indexOf(char ch, int fromIndex)
          Returns the position of the char within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'.
 int indexOf(java.lang.String sCmp)
          Returns the position of the string within the part.
 int indexOf(java.lang.String sCmp, int fromIndex, int maxToTest)
          Returns the position of the string within the part.
 int indexOfAnyChar(java.lang.String sChars)
          Returns the position of one of the chars in sChars within the part, returns -1 if the char is not found in the actual part.
 int indexOfAnyChar(java.lang.String sChars, int fromWhere, int maxToTest)
          Returns the position of one of the chars in sChars within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'.
 int indexOfAnyCharOutsideQuotion(java.lang.String sChars, int fromWhere, int maxToTest)
          Searches any char contented in sChars, but skip over quotions while testing.
 int indexOfAnyString(java.lang.String[] listStrings, int fromWhere, int maxToTest, int[] nrofFoundString, java.lang.String[] foundString)
          Returns the position of one of the chars in sChars within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'.
 int indexOfNoChar(java.lang.String sChars)
          Returns the position of the first char other than the chars in sChars within the part, returns -1 if all chars inside the parts are chars given by sChars.
 int indexOfNoChar(java.lang.String sChars, int fromWhere)
          Returns the position of the first char other than the chars in sChars within the part, started inside the part with fromIndex, returns -1 if all chars inside the parts started from 'fromIndex' are chars given by sChars.
(package private)  boolean isFound()
          Deprecated. see found()
 int lastIndexOfAnyChar(java.lang.String sChars, int fromWhere, int maxToTest)
          Returns the last position of one of the chars in sChars within the part of actual part from (fromIndex) to (fromIndex+maxToTest) or returs -1 if the char is not found in this part.
 StringPart len0end()
          Sets the length to the end of the maximal part if the length is 0.
 StringPart lenBacktoNoChar(java.lang.String sChars)
          Posits the end of the part before all of the chars given in the parameter string.
 int length()
          Returns the valid lenght of the acutual part.
 int lengthMaxPart()
          Returns the lenght of the maximal part from current position.
 StringPart lento(char cc)
          Sets the endposition of the part of string to exclusively the char cc.
 StringPart lento(int len)
          Sets the endposition of the part of string to the given chars after start.
 StringPart lento(java.lang.String ss)
          Sets the endposition of the part of string to exclusively the given string.
 StringPart lento(java.lang.String ss, int mode)
          Sets the endposition of the part of string to exclusively the given string.
 StringPart lentoAnyChar(java.lang.String sChars)
          Sets the length of the current part to any char content in sChars (terminate chars).
 StringPart lentoAnyChar(java.lang.String sChars, int maxToTest)
          Sets the length of the current part to any char content in sChars (terminate chars).
 StringPart lentoAnyChar(java.lang.String sChars, int maxToTest, int mode)
          Sets the length of the current part to any char content in sChars (terminate chars).
 StringPart lentoAnyCharOutsideQuotion(java.lang.String sChars, int maxToTest)
          Sets the length of the current part to any char content in sChars (terminate chars), but skip over quotions while testing.
 StringPart lentoAnyNonEscapedChar(java.lang.String sCharsEnd, int maxToTest)
          Sets the len to the first position of any given char, but not if the char is escaped.
 StringPart lentoAnyString(java.lang.String[] strings, int maxToTest)
          Sets the length of the current part to any terminate string given in sString.
 StringPart lentoAnyString(java.lang.String[] strings, int maxToTest, int mode)
          Sets the length of the current part to any terminate string given in sString.
 void lentoAnyStringWithIndent(java.lang.String[] strings, java.lang.String sIndentChars, int maxToTest, java.lang.StringBuilder buffer)
          Sets the length of the current part to any terminate string given in sString.
 StringPart lentoIdentifier()
          Sets the endposition of the part of string to the end of the identifier which is beginning on start.
 StringPart lentoIdentifier(java.lang.String additionalStartChars, java.lang.String additionalChars)
          Sets the endposition of the part of string to the end of the identifier which is beginning on start.
 StringPart lentoNonEscapedString(java.lang.String sEnd, int maxToTest)
          Sets the len to the first position of any given char, but not if the char is escaped.
 StringPart lentoQuotionEnd(char sEndQuotion, int maxToTest)
          Sets the length of the current part to the end of the quotion.
static java.lang.String replace(java.lang.String src, java.lang.String[] placeholder, java.lang.String[] value, java.lang.StringBuilder dst)
          Replaces up to 20 placeholder with a given content.
 StringPart scan(java.lang.String sTestP)
          scan next content, test the requested String.
private  long scanDigits(boolean bHex, int maxNrofChars)
          Scans if it is a integer number, contains exclusively of digits 0..9
private  boolean scanEntry()
           
 StringPart scanFloatNumber()
          Scans an float expression.
 StringPart scanHex(int maxNrofChars)
          Scans a sequence of hex chars a hex number.
 StringPart scanHexOrDecimal(int maxNrofChars)
          Scans a integer number possible as hex, or decimal number.
 StringPart scanIdentifier()
           
 StringPart scanIdentifier(java.lang.String additionalStartChars, java.lang.String additionalChars)
           
 StringPart scanInteger()
          Scans an integer expression with possible sign char '-' at first.
 boolean scanOk()
          Test the result of scanning and set the scan Pos Ok, if current scanning was ok.
 StringPart scanPositivInteger()
          Scanns a integer number as positiv value without sign.
 StringPart scanQuotion(java.lang.String sQuotionmarkStart, java.lang.String sQuotionMarkEnd, java.lang.String[] sResult)
           
 StringPart scanQuotion(java.lang.String sQuotionmarkStart, java.lang.String sQuotionMarkEnd, java.lang.String[] sResult, int maxToTest)
           
 StringPart scanStart()
           
 StringPart seek(char cSeek, int mode)
          Searchs the given character inside the valid part, posits the start of the part to the begin of the searched char.
 StringPart seek(int nr)
          Displaces the start of the part for some chars to left or to right.
 StringPart seek(java.lang.String sSeek, int mode)
          Searchs the given String inside the valid part, posits the start of the part to the begin of the searched string.
 StringPart seekAnyString(java.lang.String[] strings, int[] nrofFoundString)
          Searchs the given String inside the valid part, posits the start of the part to the begin of the searched string.
protected  StringPart seekBegin()
          Displaces the start of the part to the leftest possible start.
 StringPart seekNoChar(java.lang.String sChars)
          Posits the start of the part after all of the chars given in the parameter string.
 StringPart seekNoWhitespace()
          Displaces the start of the part to the first char it is no whitespace.
 StringPart seekNoWhitespaceOrComments()
          Displaces the start of the part to the first char it is no whitespace or comment.
 StringPart setBeginMaxPart()
          Sets the start of the maximal part to the actual start of the valid part.
 void setCurrentPosition(long pos)
          Sets the current position at a fix position inside the maxPart.
 boolean setIgnoreComment(boolean bSet)
          Set the mode of ignoring comments.
 boolean setIgnoreComment(java.lang.String sStart, java.lang.String sEnd)
          Set the character string of inline commentmode of ignoring comments.
 boolean setIgnoreEndlineComment(boolean bSet)
          Set the mode of ignoring comments to end of line.
 boolean setIgnoreEndlineComment(java.lang.String sStart)
          Set the character string introducing the comments to end of line.
 boolean setIgnoreWhitespaces(boolean bSet)
          Set the mode of ignoring whitespaces.
 StringPart setLengthMax()
          Sets the length to the end of the maximal part.
protected  StringPart skipWhitespaceAndComment()
          Deprecated. see seekNoWhitespaceOrComments()
 boolean startsWith(java.lang.String sCmp)
          compares the Part of string with the given string.
 java.lang.String substring(int pos, int posendP)
          Gets a substring inside the maximal part pos position of start relative to maxPart posend exclusive position of end.
private  void throwIndexOutOfBoundsException(java.lang.String sMsg)
          Central mehtod to invoke excpetion, usefull to set a breakpoint in debug or to add some standard informations.
 java.lang.String toString()
          Returns the actual part of the string.
(package private)  StringPart trim()
          Trims all leading and trailing whitespaces within the part.
(package private)  StringPart trimComment()
          Trims a java- or C-style line-comment from end of part and all leading and trailing whitespaces.
 StringPart xxxseekEnd(java.lang.String sSeek)
          Searchs the given String inside the valid part, posits the start of the part after the end of the searched string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

protected int start
The actual start position of the valid part.


end

protected int end
The actual exclusive end position of the valid part.


startMin

protected int startMin
The leftest possible start position. We speak about the 'maximal Part': The actual valid part can not exceed the borders startMin and endMax of the maximal part after any operation. The content of the associated string outside the maximal part is unconsidered. The atrributes startMin and endMax are not set by any operations except for the constructors and the set()-methods.
Set to 0 if constructed from a string, determined by the actual start if constructed from a StringPart.
In the explanation of the methods the following notation is used as samples:
abcdefghijklmnopqrstuvwxyz  Sample of the whole associated String
  =====================     The === indicates the maximal part
    -----------             The --- indicates the valid part before operation
               ++++++++     The +++ indicates the valid part after operation
      


endMax

protected int endMax
The rightest possible exclusive end position. See explanation on startMin.
Set to content.length() if constructed from a string, determined by the actual end if constructed from a StringPart


content

java.lang.String content
The referenced string


nLineCt

protected int nLineCt
The line number, counted by founded \n


bCurrentOk

protected boolean bCurrentOk
false if current scanning is not match


bStartScan

protected boolean bStartScan
If true, than all idxLastScanned... are set to 0, it is after scanOk() or after scanStart()


startLast

protected int startLast
Borders of the last part before calling of scan__(), seek__(), lento__(). If there are different to the current part, the call of restoreLastPart use this values. scanOk() sets the startLast-variable to the actual start or rewinds the actual start ot startLast.


endLast

protected int endLast
Borders of the last part before calling of scan__(), seek__(), lento__(). If there are different to the current part, the call of restoreLastPart use this values. scanOk() sets the startLast-variable to the actual start or rewinds the actual start ot startLast.


startScan

protected int startScan
Position of scanStart() or after scanOk() as start of next scan operations.


bFound

boolean bFound
True if the last operation of lento__(), seek etc. has found anything. See found().


nLastIntegerNumber

protected final long[] nLastIntegerNumber
Last scanned integer number.


idxLastIntegerNumber

private int idxLastIntegerNumber
current index of the last scanned integer number. -1=nothing scanned. 0..4=valid


nLastFloatNumber

protected final double[] nLastFloatNumber
Last scanned float number


idxLastFloatNumber

private int idxLastFloatNumber
current index of the last scanned float number. -1=nothing scanned. 0..4=valid


sLastString

protected java.lang.String sLastString
Last scanned string.


seekEnd

public static final int seekEnd
Flag to force setting the start position after the seeking string. See description on seek(String, int).

See Also:
Constant Field Values

mSeekBackward_

private static final int mSeekBackward_
Flag bit to force seeking backward. This value is contens impilicit in the mSeekBackFromStart or ~End, using to detect internal the backward mode.

See Also:
Constant Field Values

mSeekToLeft_

private static final int mSeekToLeft_
Flag bit to force seeking left from start (Backward). This value is contens impilicit in the seekBackFromStart using to detect internal the seekBackFromStart-mode.

See Also:
Constant Field Values

seekToLeft

public static final int seekToLeft
Flag to force seeking backward from the start position. See description on seek(String).

See Also:
Constant Field Values

seekBack

public static final int seekBack
Flag to force seeking backward from the end position. See description on seek(String).

See Also:
Constant Field Values

seekNormal

public static final int seekNormal
Flag to force seeking forward. See description on seek(String).

See Also:
Constant Field Values

bitMode

protected int bitMode
Some mode bits


mSkipOverWhitespace_mode

protected static final int mSkipOverWhitespace_mode
Bit in mode. If this bit ist set, all whitespace are overreaded before calling any scan method.

See Also:
Constant Field Values

mSkipOverCommentInsideText_mode

protected static final int mSkipOverCommentInsideText_mode
Bit in mode. If this bit ist set, all comments are overreaded before calling any scan method.

See Also:
Constant Field Values

mSkipOverCommentToEol_mode

protected static final int mSkipOverCommentToEol_mode
Bit in mode. If this bit ist set, all comments are overreaded before calling any scan method.

See Also:
Constant Field Values

sCommentStart

java.lang.String sCommentStart
The string defined the start of comment inside a text.


sCommentEnd

java.lang.String sCommentEnd
The string defined the end of comment inside a text.


sCommentToEol

java.lang.String sCommentToEol
The string defined the start of comment to end of line


cStartOfText

public static final char cStartOfText
The char used to code start of text.

See Also:
Constant Field Values

cEndOfText

public static final char cEndOfText
The char used to code end of text.

See Also:
Constant Field Values
Constructor Detail

StringPart

public StringPart()
Creates a new empty StringPart without an associated String. See method set() to assign a String.


StringPart

public StringPart(java.lang.String content)
Creates a new StringPart, with the given content from a String. Initialy the whole string is valid and determines the maximal part.

Parameters:
content - The content, that String is associated by this.

StringPart

public StringPart(StringPart src)
Creates a new StringPart with the same String as the given StringPart. The maximal part of the new StringPart are determined from the actual valid part of the src. The actual valid part is equal to the maximal one.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
    ----------------        The valid part of src
    ================        The maximal part and initial the valid part of this
    +++++   ++++            Possible valid parts of this after some operations
       ++++      +++        Possible also
  +++++           ++++ +++  Never valid parts of this after operations because they exceeds the borders of maximal part.
      

Parameters:
src - The given StringPart.
Method Detail

assign

public StringPart assign(java.lang.String content)
Sets the content to the given string, forgets the old content. Initialy the whole string is valid.

Parameters:
content - The content.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

assign

public StringPart assign(StringPart src)
Sets the StringPart with the same String object as the given StringPart, forgets the old content. The borders of the new StringPart (the maximal part) are determined from the actual valid part of the src. The actual valid part is equal to this limits. If the src is the same instance as this (calling with 'this'), than the effect is the same. The maximal Part is determined from the unchanged actual part.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
    ----------------        The valid part of src
    ================        The maximal part and initial the valid part of this
    +++++   ++++            Possible valid parts of this after some operations
       ++++      +++        Possible also
  +++++           ++++ +++  Never valid parts of this after operations because they exceeds the borders of maximal part.
      

Parameters:
src - The given StringPart.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

assignFromEnd

public StringPart assignFromEnd(StringPart src)
Sets the content of the StringPart , forgets the old content. The same string like in src is associated. Initialy the part from the end of the src-part to the maximal end of src is valid. The valid part and the maximal part is set in this same way.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =====================     The maximal part of src
    ------                  The valid part of src
          =============     The maximal and initialy the valid part of this
      

Parameters:
src - The source of the operation.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

setIgnoreComment

public boolean setIgnoreComment(boolean bSet)
Set the mode of ignoring comments. If it is set, comments are always ignored on every scan operation. On scan, the current position is set first after a comment if the current position began with a comment. This mode may or should be combinded with setIgnoreWhitespace.
The string introduces and finishes a comment is setted by calling setIgnoreComment(String sStart, String sEnd). The default value is "/ *" and "* /" like in java-programming.

Parameters:
bSet - If true than ignore, if false than comments are normal input to parse.
Returns:
The last definition of this feature.

setIgnoreComment

public boolean setIgnoreComment(java.lang.String sStart,
                                java.lang.String sEnd)
Set the character string of inline commentmode of ignoring comments. After this call, comments are always ignored on every scan operation. On scan, the current position is set first after a comment if the current position began with a comment. This mode may or should be combinded with setIgnoreWhitespace.

Parameters:
sStart - Start character string of a inline comment
sEnd - End character string of a inline comment
Returns:
The last definition of the feature setIgnoreComment(boolean).

setIgnoreEndlineComment

public boolean setIgnoreEndlineComment(boolean bSet)
Set the mode of ignoring comments to end of line. If it is set, end-line-comments are always ignored on every scan operation. On scan, the current position is set first after a comment if the current position began with a comment. This mode may or should be combinded with setIgnoreWhitespace.
The string introduces a endofline-comment is setted by calling setEndlineCommentString(). The default value is "//" like in java-programming.

Parameters:
bSet - If true than ignore, if false than comments are normal input to parse.
Returns:
The last definition of the feature setIgnoreComment(boolean).

setIgnoreEndlineComment

public boolean setIgnoreEndlineComment(java.lang.String sStart)
Set the character string introducing the comments to end of line. After this call, endline-comments are always ignored on every scan operation. On scan, the current position is set first after a comment if the current position began with a comment. This mode may or should be combinded with setIgnoreWhitespace.

Parameters:
sStart - String introducing end line comment
Returns:
The last definition of this feature.

setIgnoreWhitespaces

public boolean setIgnoreWhitespaces(boolean bSet)
Set the mode of ignoring whitespaces. If it is set, whitespaces are always ignored on every scan operation. On scan, the current position is set first after a comment if the current position began with a comment. This mode may or should be combinded with setIgnoreWhitespace.
The chars accepted as whitespace are setted by calling setWhiteSpaceCharacters(). The default value is " \t\r\n\f" like in java-programming.

Parameters:
bSet - If true than ignore, if false than comments are normal input to parse.
Returns:
The last definition of this feature.

setBeginMaxPart

public StringPart setBeginMaxPart()
Sets the start of the maximal part to the actual start of the valid part. See also seekBegin(), that is the opposite operation.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
    ================        The maximal part before operation
         ------             The actual part
         ===========        The maximal part after operation
      

Parameters:
src - The given StringPart.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

fromEnd

public StringPart fromEnd()
Sets the start of the part to the exclusively end, set the end to the end of the content.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =================         The maximal part
         -----              The valid part before
              +++++         The valid part after.
      

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

getLineCt

public int getLineCt()
get the Line ct

Returns:
Number of last readed line.

getLen

public int getLen()
Deprecated. 

Gets the length of the valid part. See length().


length

public int length()
Returns the valid lenght of the acutual part. Returns also 0 if no string is valid.

Returns:
number of chars actual valid.

lengthMaxPart

public int lengthMaxPart()
Returns the lenght of the maximal part from current position. Returns also 0 if no string is valid.

Returns:
number of chars from current position to end of maximal part.

lento

public StringPart lento(int len)
                 throws java.lang.IndexOutOfBoundsException
Sets the endposition of the part of string to the given chars after start.

Parameters:
len - The new length. It must be positive.
Returns:
this to concat some operations.
Throws:
java.lang.IndexOutOfBoundsException - if the len is negativ or greater than the position endMax.

lento

public StringPart lento(char cc)
Sets the endposition of the part of string to exclusively the char cc. If the char cc is not found, the end position is set to start position, so the part of string is emtpy. It is possible to call set0end() to set the end of the part to the maximal end if the char is not found. That is useful by selecting a part to a separating char such ',' but the separator is not also the terminating char of the last part.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =================         The maximal part of src
         -----              The valid part of src before calling the method
         +                  after calling lento('w') the end is set to start
                            position, the length() is 0, because the 'w' is outside.
         ++++++++++         calling set0end() is possible and produce this result.
      

Parameters:
cc - char to determine the exclusively end char.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

lento

public StringPart lento(java.lang.String ss)
Sets the endposition of the part of string to exclusively the given string. If the string is not found, the end position is set to start position, so the part of string is emtpy. It is possible to call set0end() to set the end of the part to the maximal end if the char is not found. That is useful by selecting a part to a separating char such ',' but the separator is not also the terminating char of the last part, example see lento(char cc)

Parameters:
ss - string to determine the exclusively end char.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

lento

public StringPart lento(java.lang.String ss,
                        int mode)
Sets the endposition of the part of string to exclusively the given string. If the string is not found, the end position is set to start position, so the part of string is emtpy. It is possible to call set0end() to set the end of the part to the maximal end if the char is not found. That is useful by selecting a part to a separating char such ',' but the separator is not also the terminating char of the last part, example see lento(char cc)

Parameters:
ss - string to determine the exclusively end char.
mode - Mode of seeking the end, seekEnd or 0 is possible.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

lentoIdentifier

public StringPart lentoIdentifier()
Sets the endposition of the part of string to the end of the identifier which is beginning on start. If the part starts not with a identifier char, the end is set to the start position.
example:
abcd  this is a part uvwxyz The associated String
  =====================     The border of valid parts of src
       -------              The valid part of the src before calling the method
       +++                  after calling lentoIdentifier(). The start position
                            is not effected. That's why the identifier-part is only "his".
      

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

lentoIdentifier

public StringPart lentoIdentifier(java.lang.String additionalStartChars,
                                  java.lang.String additionalChars)
Sets the endposition of the part of string to the end of the identifier which is beginning on start. If the part starts not with a identifier char, the end is set to the start position.

Parameters:
additionalChars - String of additinal chars there are also accept as identifier chars.
See Also:
lentoIdentifier().

lentoAnyNonEscapedChar

public StringPart lentoAnyNonEscapedChar(java.lang.String sCharsEnd,
                                         int maxToTest)
Sets the len to the first position of any given char, but not if the char is escaped. 'Escaped' means, a \ is disposed before the char. Example: lentoAnyNonEscapedChar("\"") ends not at a \", but at ". it detects the string "this is a \"quotion\"!".
This method doesn't any things, if the last scanning call isn't match. Invoking of scanOk() before guarantees that the method works.

Parameters:
sCharsEnd - Assembling of chars determine the end of the part.

lentoNonEscapedString

public StringPart lentoNonEscapedString(java.lang.String sEnd,
                                        int maxToTest)
Sets the len to the first position of any given char, but not if the char is escaped. 'Escaped' means, a \ is disposed before the char. Example: lentoAnyNonEscapedChar("\"") ends not at a \", but at ". it detects the string "this is a \"quotion\"!".
This method doesn't any things, if the last scanning call isn't match. Invoking of scanOk() before guarantees that the method works.

Parameters:
sCharsEnd - Assembling of chars determine the end of the part.

seek

public StringPart seek(int nr)
Displaces the start of the part for some chars to left or to right. If the seek operation would exceeds the maximal part borders, a StringIndexOutOfBoundsException is thrown.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =================         The maximal part
         -----              The valid part before
       +++++++              The valid part after calling seek(-2).
           +++              The valid part after calling seek(2).
             +              The valid part after calling seek(5).
                            The start is set to end, the lenght() is 0.
  ++++++++++++              The valid part after calling seek(-5).
      

Parameters:
nr - of positions to displace. Negative: Displace to left.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

seekNoWhitespace

public StringPart seekNoWhitespace()
Displaces the start of the part to the first char it is no whitespace. If the current char at seek position is not a whitespace, the method has no effect. If only whitespaces are founded to the end of actual part, the position is set to this end.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =================         The maximal part
    ----------              The valid part before
       +++++++              The valid part after, if 'defg' are whitespaces
    ++++++++++              The valid part after is the same as before, if no whitespace at current position
             .              The valid part after is emtpy, if only whitespaces re found.
      

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

skipWhitespaceAndComment

protected StringPart skipWhitespaceAndComment()
Deprecated. see seekNoWhitespaceOrComments()


seekNoWhitespaceOrComments

public StringPart seekNoWhitespaceOrComments()
Displaces the start of the part to the first char it is no whitespace or comment. If the current char at seek position is not a whitespace or not the beginning of a comment, the method has no effect. If only whitespaces and comments are found to the end of actual part, the position is set to its end.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =================         The maximal part
    ----------              The valid part before
       +++++++              The valid part after, if 'defg' are whitespaces
    ++++++++++              The valid part after is the same as before, if no whitespace at current position
             .              The valid part after is emtpy, if only whitespaces re found.
      

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

isFound

boolean isFound()
Deprecated. see found()


found

public boolean found()
Returns true, if the last called seek__(), lento__() or skipWhitespaceAndComment() operation founds the requested condition. This methods posits the current Part in a appropriate manner if the seek or lento-conditions were not prosperous. In this kinds this method returns false.

Returns:
true if the last seek__(), lento__() or skipWhitespaceAndComment() operation matches the condition.

seekBegin

protected StringPart seekBegin()
Displaces the start of the part to the leftest possible start.
example:
abcdefghijklmnopqrstuvwxyz  The associated String
  =================         The maximal part
         -----              The valid part before
  ++++++++++++              The valid part after calling seekBegin().
      

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

seek

public StringPart seek(java.lang.String sSeek,
                       int mode)
Searchs the given String inside the valid part, posits the start of the part to the begin of the searched string. The end of the part is not affected. If the string is not found, the start is posit on the actual end. The length()-method supplies 0. Methods such fromEnd() are not interacted from the result of the searching. The rule is: seek()-methods only shifts the start position.
example:
that is a liststring and his part The associated String
  =============================   The maximal part
      ----------------------      The valid part before
           +++++++++++++++++      The valid part after seek("is",StringPart.seekNormal).
             +++++++++++++++      The valid part after seek("is",StringPart.seekEnd).
                          ++      The valid part after seek("is",StringPart.back).
                           .      The valid part after seek("is",StringPart.back + StringPart.seekEnd).
     +++++++++++++++++++++++      The valid part after seek("is",StringPart.seekToLeft).
       +++++++++++++++++++++      The valid part after seek("is",StringPart.seekToLeft + StringPart.seekEnd).
  ++++++++++++++++++++++++++      The valid part after seek("xx",StringPart.seekToLeft).
                           .      The valid part after seek("xx",StringPart.seekNormal)
                                  or seek("xx",StringPart.back).

      

Parameters:
sSeek - The string to search for.
mode - Mode of seeking, use ones of back, seekToLeft, seekNormal, added with seekEnd.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

seekAnyString

public StringPart seekAnyString(java.lang.String[] strings,
                                int[] nrofFoundString)
Searchs the given String inside the valid part, posits the start of the part to the begin of the searched string. The end of the part is not affected.
If the string is not found, the start is posit to the actual end. The length()-method supplies 0. Methods such fromEnd() are not interacted from the result of the searching. The rule is: seek()-methods only shifts the start position.
see seek(String sSeek, int mode)

Parameters:
strings - List of String contains the strings to search.
nrofFoundString - If given, [0] is set with the number of the found String in listStrings, count from 0. This array reference may be null, then unused.
Returns:
this.

seek

public StringPart seek(char cSeek,
                       int mode)
Searchs the given character inside the valid part, posits the start of the part to the begin of the searched char. The end of the part is not affected. If the string is not found, the start is posit on the actual end or, if mode contents seekBack, the begin of the maximal part. In this cases isFound() returns false and a call of restoreLastPart() restores the old parts. The length()-method supplies 0. Methods such fromEnd() are not interacted from the result of the searching. The rule is: seek()-methods only shifts the start position.
The examples are adequate to seek(String, int mode);

Parameters:
cSeek - The character to search for.
mode - Mode of seeking, use ones of back, seekToLeft, seekNormal, added with seekEnd.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

xxxseekEnd

public StringPart xxxseekEnd(java.lang.String sSeek)
Searchs the given String inside the valid part, posits the start of the part after the end of the searched string. The end of the part is not affected.
sample: seek("fgh") results is:
                abcdefghijabcdefghijklmnopq
      before:            ============
      after:                      ===
      not:              =============
                             
If the string is not found, the start is posit on the actual end. The length()-method supplies 0. Methods such fromEnd() are not interacted from the result of the searching. The rule is: seek()-methods only shifts the start position.

Parameters:
sSeek - The string to search for.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

seekNoChar

public StringPart seekNoChar(java.lang.String sChars)
Posits the start of the part after all of the chars given in the parameter string. The end of the part is not affected.
sample: seekNoChar("123") result is:
                12312312312abcd12312efghij123123
      before:       ==========================
      after:               ===================
                             

Parameters:
sChars - String with the chars to overread.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

indexOfAnyChar

public int indexOfAnyChar(java.lang.String sChars,
                          int fromWhere,
                          int maxToTest)
Returns the position of one of the chars in sChars within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'.

Parameters:
sChars - contents some chars to find. The char with code
fromIndex - start of search within the part.
maxToTest - maximal numbers of chars to test. It may be Integer.MAX_VALUE.
Returns:
position of first founded char inside the actual part, but not greater than maxToTest, if no chars is found unitl maxToTest, but -1 if the end is reached.

lastIndexOfAnyChar

public int lastIndexOfAnyChar(java.lang.String sChars,
                              int fromWhere,
                              int maxToTest)
Returns the last position of one of the chars in sChars within the part of actual part from (fromIndex) to (fromIndex+maxToTest) or returs -1 if the char is not found in this part.

Parameters:
sChars - contents some chars to find. The char with code
fromIndex - start of search within the part.
maxToTest - maximal numbers of chars to test. It may be Integer.MAX_VALUE.
Returns:
position of first founded char inside the actual part, but not greater than maxToTest. if no chars is found unitl maxToTest, but -1 if the end is reached.

indexOfAnyString

public int indexOfAnyString(java.lang.String[] listStrings,
                            int fromWhere,
                            int maxToTest,
                            int[] nrofFoundString,
                            java.lang.String[] foundString)
Returns the position of one of the chars in sChars within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'.

Parameters:
listStrings - contains some Strings to find.
fromWhere - start of search within the part.
maxToTest - maximal numbers of chars to test. It may be Integer.MAX_VALUE.
nrofFoundString - If given, [0] is set with the number of the found String in listStrings, count from 0. This array reference may be null, then unused.
foundString - If given, [0] is set with the found String. This array reference may be null.
Returns:
position of first founded char inside the actual part, but not greater than maxToTest, if no chars is found until maxToTest, but -1 if the end is reached.

indexOfAnyCharOutsideQuotion

public int indexOfAnyCharOutsideQuotion(java.lang.String sChars,
                                        int fromWhere,
                                        int maxToTest)
Searches any char contented in sChars, but skip over quotions while testing. Example: The given string is
 abc "yxz" end:zxy
The calling is
 lentoAnyCharOutsideQuotion("xyz", 20);
The result current part is
 abc "yxz" end:
because the char 'z' is found first as the end char, but outside the quoted string "xyz".

Parameters:
sChars - One of this chars is a endchar. It may be null: means, every chars is a endchar.
fromWhere - Offset after start to start search. It may be 0 in many cases.
maxToTest -
Returns:

indexEndOfQuotion

public int indexEndOfQuotion(char cEndQuotion,
                             int fromWhere,
                             int maxToTest)
Searches the end of a quotion string.

Parameters:
fromWhere - Offset after start to start search. It may be 0 if the quotion starts at start, it is the position of the left quotion mark.
maxToTest - Limit for searching, offset from start. It may be Integer.MAX_INT
Returns:
-1 if no end of quotion is found, else the position of the char after the quotion, at least 2 because a quotion has up to 2 chars, the quotion marks itself.

indexOfAnyChar

public int indexOfAnyChar(java.lang.String sChars)
Returns the position of one of the chars in sChars within the part, returns -1 if the char is not found in the actual part.

Parameters:
sChars - contents some chars to find.
Returns:
position of first founded char inside the actual part or -1 if not found.

indexOfNoChar

public int indexOfNoChar(java.lang.String sChars,
                         int fromWhere)
Returns the position of the first char other than the chars in sChars within the part, started inside the part with fromIndex, returns -1 if all chars inside the parts started from 'fromIndex' are chars given by sChars.

Parameters:
sChars - contents the chars to overread.
fromIndex - start of search within the part.
Returns:
position of first foreign char inside the actual part or -1 if not found.

indexOfNoChar

public int indexOfNoChar(java.lang.String sChars)
Returns the position of the first char other than the chars in sChars within the part, returns -1 if all chars inside the parts are chars given by sChars.

Parameters:
sChars - contents the chars to overread.
Returns:
position of first foreign char inside the actual part or -1 if not found.

lentoAnyChar

public StringPart lentoAnyChar(java.lang.String sChars,
                               int maxToTest)
Sets the length of the current part to any char content in sChars (terminate chars). If a terminate char is not found, the length of the current part is set to 0. The same result occurs, if a terminate char is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.

Parameters:
sChars - Some chars searched as terminate char for the actual part.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
mode - Possible values are StringPart.seekBack or StringPart.seekNormal = 0.
Returns:
This itself.

lentoAnyChar

public StringPart lentoAnyChar(java.lang.String sChars,
                               int maxToTest,
                               int mode)
Sets the length of the current part to any char content in sChars (terminate chars). If a terminate char is not found, the length of the current part is set to 0. The same result occurs, if a terminate char is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.

Parameters:
sChars - Some chars searched as terminate char for the actual part.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
mode - Possible values are StringPart.seekBack or StringPart.seekNormal = 0.
Returns:
This itself.

lentoAnyString

public StringPart lentoAnyString(java.lang.String[] strings,
                                 int maxToTest)
Sets the length of the current part to any terminate string given in sString. If a terminate string is not found, the length of the current part is set to 0. The same result occurs, if a terminate string is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.

Parameters:
sString - The first char is the separator.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
Returns:
This itself.

lentoAnyString

public StringPart lentoAnyString(java.lang.String[] strings,
                                 int maxToTest,
                                 int mode)
Sets the length of the current part to any terminate string given in sString. If a terminate string is not found, the length of the current part is set to 0. The same result occurs, if a terminate string is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.

Parameters:
sString - The first char is the separator.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
mode - possible values are StrinPart.seekNormal or StringPart.seekEnd.
  • StringPart.seekEnd: the found string is inclusive.
Returns:
This itself.

lentoAnyStringWithIndent

public void lentoAnyStringWithIndent(java.lang.String[] strings,
                                     java.lang.String sIndentChars,
                                     int maxToTest,
                                     java.lang.StringBuilder buffer)
Sets the length of the current part to any terminate string given in sString. If a terminate string is not found, the length of the current part is set to 0. The same result occurs, if a terminate string is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.
This method consideres the indent of the first line. In followed lines all chars are skipped if there are inclose in sIndentChars until the column position of the first line. If another char not inclosed in sIndentChars is found, than it is the beginning of this line. If the last char in sIndentChars is a space " ", additional all spaces and tabs '\t' will be skipped. This method is helpfull to convert indented text into a string without the indents, at example:
 . /** This is a comment
 .   * continued in a next line with indent.
 .  but it is able that the user doesn't respect the indentation
 .        also with to large indentation,
 .   * *The second asterix should not be skipped.
 
From this text passage the result is:
 .This is a comment
 .continued in a next line with indent.
 .but it is able that the user doesn't respect the indentation
 .also with to large indentation,
 .*The second asterix should not be skipped.
 
Using the result it is possible to detect paragraph formatting in wikipedia style (see vishia.xml.ConvertWikistyleTextToXml.java)

Parameters:
strings - List of type String, containing the possible end strings.
iIndentChars - possible chars inside a skipped indentation. If the last char is space (" "), also spaces after the indentation of the first line are skipped.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
buffer - The buffer where the found String is stored. The stored String has no indentations.
Since:
2007, 2010-0508 changed param buffer, because better useable in C (java2c)

lentoAnyCharOutsideQuotion

public StringPart lentoAnyCharOutsideQuotion(java.lang.String sChars,
                                             int maxToTest)
Sets the length of the current part to any char content in sChars (terminate chars), but skip over quotions while testing. Example: The given string is
 abc "yxz" ende:zxy
The calling is
 lentoAnyCharOutsideQuotion("xyz", 20);
The result current part is
 abc "yxz" ende:
because the char 'z' is found first as the end char, but outside the quoted string "xyz".
If a terminate char is not found, the length of the current part is set to 0. The same result occurs, if a terminate char is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.

Parameters:
sChars - Some chars searched as terminate char for the actual part.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
Returns:
This itself.

lentoQuotionEnd

public StringPart lentoQuotionEnd(char sEndQuotion,
                                  int maxToTest)
Sets the length of the current part to the end of the quotion. It is not tested here, whether or not the actual part starts with a left quotion mark.

Parameters:
sEndQuotion - The char determine the end of quotion, it may be at example " or ' or >.
maxToTest - Maximum of chars to test. If the endchar isn't find inside this number of chars, the actual length is set to 0.
Returns:
This itself.

lentoAnyChar

public StringPart lentoAnyChar(java.lang.String sChars)
Sets the length of the current part to any char content in sChars (terminate chars). If a terminate char is not found, the length of the current part is set to 0. The same result occurs, if a terminate char is found at begin of the current part. If the difference of this behavior is important, use instead indexOfAnyChar() and test the return value, if it is < 0.

Parameters:
sChars - Some chars searched as terminate char for the actual part.
Returns:
This itself.

len0end

public StringPart len0end()
Sets the length to the end of the maximal part if the length is 0. This method could be called at example if a end char is not detected and for that reason the part is valid to the end.

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

setLengthMax

public StringPart setLengthMax()
Sets the length to the end of the maximal part.


lenBacktoNoChar

public StringPart lenBacktoNoChar(java.lang.String sChars)
Posits the end of the part before all of the chars given in the parameter string. The start of the part is not affected.
sample: lentoBacktoNoChar("123") result is:
                1231231231abcd12312efghij123123123klmnopq
      before:       ==========================
      after:        =====================
                             

Parameters:
sChars - String with the chars to overread.
Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

trim

StringPart trim()
Trims all leading and trailing whitespaces within the part. A Comment begins with "//".

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

trimComment

StringPart trimComment()
Trims a java- or C-style line-comment from end of part and all leading and trailing whitespaces. A Comment begins with "//".

Returns:
this to concat some operations, like part.set(src).seek(sKey).lento(';').len0end();

indexOf

public int indexOf(char ch)
Returns the position of the char within the part, returns -1 if the char is not found in the part. The methode is likely String.indexOf().

Parameters:
ch - character to find.
Returns:
position of the char within the part or -1 if not found within the part.
Throws:
The - method throws no IndexOutOfBoundaryException. It is the same behavior like String.indexOf(char, int fromEnd).

indexOf

public int indexOf(char ch,
                   int fromIndex)
Returns the position of the char within the part, started inside the part with fromIndex, returns -1 if the char is not found in the part started from 'fromIndex'. The methode is likely String.indexOf().

Parameters:
ch - character to find.
fromIndex - start of search within the part.
Returns:
position of the char within the part or -1 if not found within the part.
Throws:
The - method throws no IndexOutOfBoundaryException. If the value of fromIndex is negativ or greater than the end position, -1 is returned (means: not found). It is the same behavior like String.indexOf(char, int fromEnd).

indexOf

public int indexOf(java.lang.String sCmp)
Returns the position of the string within the part. Returns -1 if the string is not found in the part. Example: indexOf("abc") returns 6, indexOf("fgh") returns -1
         abcdefgabcdefghijk
  part:   =============  

Parameters:
sCmp - string to find
Returns:
position of the string within the part or -1 if not found within the part.

indexOf

public int indexOf(java.lang.String sCmp,
                   int fromIndex,
                   int maxToTest)
Returns the position of the string within the part. Returns -1 if the string is not found in the part. Example: indexOf("abc") returns 6, indexOf("fgh") returns -1
         abcdefgabcdefghijk
  part:   =============  

Parameters:
sCmp - string to find
Returns:
position of the string within the part or -1 if not found within the part.

equals

public boolean equals(java.lang.String sCmp)
Compares the Part of string with the given string


startsWith

public boolean startsWith(java.lang.String sCmp)
compares the Part of string with the given string. new since 2008-09: if sCmp contains a cEndOfText char (coded with \e), the end of text is tested.

Parameters:
sCmp - The text to compare.

scan

public StringPart scan(java.lang.String sTestP)
scan next content, test the requested String. new since 2008-09: if sTest contains cEndOfText, test whether this is the end. skips over whitespaces and comments automatically, depends on the settings forced with calling of seekNoWhitespaceOrComments() .
See global description of scanning methods.

Parameters:
sTest - String to test
Returns:
this

scanOk

public boolean scanOk()
Test the result of scanning and set the scan Pos Ok, if current scanning was ok. If current scanning was not ok, this method set the current scanning pos back to the position of the last call of scanOk() or scanNext() or setCurrentOk().

Returns:
true if the current scanning was ok, false if it was not ok.

scanQuotion

public StringPart scanQuotion(java.lang.String sQuotionmarkStart,
                              java.lang.String sQuotionMarkEnd,
                              java.lang.String[] sResult)
Parameters:
sQuotionmarkStart -
sQuotionMarkEnd -
sResult -
Returns:

scanQuotion

public StringPart scanQuotion(java.lang.String sQuotionmarkStart,
                              java.lang.String sQuotionMarkEnd,
                              java.lang.String[] sResult,
                              int maxToTest)
Parameters:
sQuotionmarkStart -
sQuotionMarkEnd -
sResult -
maxToTest -
Returns:

scanDigits

private long scanDigits(boolean bHex,
                        int maxNrofChars)
Scans if it is a integer number, contains exclusively of digits 0..9

Parameters:
bHex - true: scan hex Digits and realize base 16, otherwise realize base 10.
Returns:
long number represent the digits.

scanStart

public StringPart scanStart()
Returns:

scanEntry

private boolean scanEntry()

scanPositivInteger

public StringPart scanPositivInteger()
                              throws java.text.ParseException
Scanns a integer number as positiv value without sign. All digit character '0' to '9' will be proceed. The result as long value is stored internally and have to be got calling getLastScannedIntegerNumber(). There can stored upto 5 numbers. If more as 5 numbers are stored yet, an exception is thrown.

Returns:
Throws:
java.text.ParseException - if the buffer is not free to hold an integer number.

scanInteger

public StringPart scanInteger()
                       throws java.text.ParseException
Scans an integer expression with possible sign char '-' at first. The result as long value is stored internally and have to be got calling getLastScannedIntegerNumber(). There can stored upto 5 numbers. If more as 5 numbers are stored yet, an exception is thrown.

Returns:
this
Throws:
java.text.ParseException - if the buffer is not free to hold an integer number.

scanFloatNumber

public StringPart scanFloatNumber()
                           throws java.text.ParseException
Scans an float expression. The result as long value is stored internally and have to be got calling getLastScannedIntegerNumber(). There can stored upto 5 numbers. If more as 5 numbers are stored yet, an exception is thrown.

Returns:
this
Throws:
java.text.ParseException - if the buffer is not free to hold an integer number.

scanHex

public StringPart scanHex(int maxNrofChars)
                   throws java.text.ParseException
Scans a sequence of hex chars a hex number. No '0x' or such should be present. See scanHexOrInt(). The result as long value is stored internally and have to be got calling getLastScannedIntegerNumber(). There can stored upto 5 numbers. If more as 5 numbers are stored yet, an exception is thrown.

Throws:
java.text.ParseException - if the buffer is not free to hold an integer number.

scanHexOrDecimal

public StringPart scanHexOrDecimal(int maxNrofChars)
                            throws java.text.ParseException
Scans a integer number possible as hex, or decimal number. If the number starts with 0x it is hexa. Otherwise it is a decimal number. Octal numbers are not supported! The result as long value is stored internally and have to be got calling getLastScannedIntegerNumber(). There can stored upto 5 numbers. If more as 5 numbers are stored yet, an exception is thrown.

Parameters:
maxNrofChars - The maximal number of chars to scan, if <=0 than no limit.
Returns:
this to concatenate the call.
Throws:
java.text.ParseException - if the buffer is not free to hold an integer number.

scanIdentifier

public StringPart scanIdentifier()
Returns:

scanIdentifier

public StringPart scanIdentifier(java.lang.String additionalStartChars,
                                 java.lang.String additionalChars)
Parameters:
additionalStartChars -
additionalChars -
Returns:

getLastScannedIntegerNumber

public long getLastScannedIntegerNumber()
                                 throws java.text.ParseException
Returns the last scanned integer number. It is the result of the methods

Returns:
The number in long format. A cast to int, short etc. may be necessary depending on the expectable values.
Throws:
java.text.ParseException - if called though no scan routine was called.

getLastScannedFloatNumber

public double getLastScannedFloatNumber()
                                 throws java.text.ParseException
Returns the last scanned float number.

Returns:
The number in double format. A cast to float may be necessary depending on the expectable values and the storing format.
Throws:
java.text.ParseException - if called though no scan routine was called.

getLastScannedString

public java.lang.String getLastScannedString()

getCircumScriptionToAnyChar

public java.lang.String getCircumScriptionToAnyChar(java.lang.String sCharsEnd)
Gets a String with translitaration. The end of the string is determined by any of the given chars. But a char directly after the escape char \ is not detected as an end char. Example: getCircumScriptionToAnyChar("\"") ends not at a char " after an \, it detects the string "this is a \"quotion\"!". Every char after the \ is accepted. But the known subscription chars \n, \r, \t, \f, \b are converted to their control-char- equivalence. The \s and \e mean start and end of text, coded with ASCII-STX and ETX = 0x2 and 0x3.

The actual part is tested for this, after this operation the actual part begins after the getting chars!

Parameters:
sCharsEnd - Assembling of chars determine the end of the part.

getCircumScriptionToAnyCharOutsideQuotion

public java.lang.String getCircumScriptionToAnyCharOutsideQuotion(java.lang.String sCharsEnd)

getCircumScriptionToAnyChar_p

private java.lang.String getCircumScriptionToAnyChar_p(java.lang.String sCharsEnd,
                                                       boolean bOutsideQuotion)

getCurrentPosition

public long getCurrentPosition()
Gets the current position, useable for rewind. This method is overwritten if derived classes uses partial content.


setCurrentPosition

public void setCurrentPosition(long pos)
Sets the current position at a fix position inside the maxPart. TODO what is with rewind etc? see old StringScan. Idea: the max Part is never enlargeable to left, only made smaller to rihht. Thats why the left border of maxPart is useable for shift left the content by reading the next content from file, if the buffer is limited, larger than necessarry for a whole file's content. But all pos values should be relativ. getCurrentPos must return a relativ value, if shiftness is used. this method shuld use a relativ value. old:, useable for rewind. This method may be overwritten if derived classes uses partial content.

Parameters:
pos - the absolute position

substring

public java.lang.String substring(int pos,
                                  int posendP)
Gets a substring inside the maximal part pos position of start relative to maxPart posend exclusive position of end. If 0 or negativ, it counts from end backward.


getCurrent

public java.lang.String getCurrent(int nChars)
Gets the next chars from current Position. This method don't consider the spread of the actutal and maximal part.

Parameters:
nChars - number of chars to return. If the number of chars available in string is less than the required number, only the available string is returned.

getCurrentChar

public char getCurrentChar()
Gets the next char at current Position.


getCurrentColumn

public int getCurrentColumn()
Gets the current position in line (column of the text). It is the number of chars from the last '\n' or from beginning to the actual char.

Returns:
Position of the actual char from start of line, leftest position is 0.

getCurrentPart

public java.lang.String getCurrentPart()
Returns the actual part of the string.


getLastPart

public java.lang.String getLastPart()
Returns the last part of the string before any seek or scan operation.


getCurrentPart

public java.lang.String getCurrentPart(int maxLength)
Returns the actual part of the string.


toString

public java.lang.String toString()
Returns the actual part of the string.
The StringPart may be used within a string concatation such as
      String xy = "abc" + spStringPart + "xyz";
In this case the StringPart is accept as a Object and the Object.toString() is called. This method is here implemented. So a StringPart is usualable directly in concatation.

Overrides:
toString in class java.lang.Object

debugString

public java.lang.String debugString()
Returns a debug information of the content of the StringPart. This information is structured in the followed way:
"CONTENT_FROM_BEGIN<<<34,45>>>CONTENT_PART<<<"
whereat

throwIndexOutOfBoundsException

private void throwIndexOutOfBoundsException(java.lang.String sMsg)
                                     throws java.lang.IndexOutOfBoundsException
Central mehtod to invoke excpetion, usefull to set a breakpoint in debug or to add some standard informations.

Parameters:
sMsg -
Throws:
java.lang.IndexOutOfBoundsException

replace

public static java.lang.String replace(java.lang.String src,
                                       java.lang.String[] placeholder,
                                       java.lang.String[] value,
                                       java.lang.StringBuilder dst)
Replaces up to 20 placeholder with a given content. The method creates a StringBuilder with buffer and a StringPart locally.

Parameters:
src - The source String, it may be a line.
placeholder - An array of strings, any string of them may be found in the src.
value - An array of strings appropriate to the placeholder. Any found placeholder will be substitute with that string.
dst - A given StringBuilder-instance. If null, then a StringBuilder will be created here
Returns:
The changed string contained in dst or a created StringBuilder.