| java.lang.Object org.netbeans.editor.Analyzer
Analyzer | public class Analyzer (Code) | | Various text analyzes over the document
author: Miloslav Metelka version: 1.00 |
Method Summary | |
public static boolean | blocksHit(int[] blocks, int startPos, int endPos) | public static int | blocksIndex(int[] blocks, int startPos, int endPos) | public static char[] | concat(char[] chars1, char[] chars2) | public static int | convertLFToLS(char[] src, int len, char[] tgt, String lsType) Convert text with LF line separators to text that uses line separators of
the document. | public static int | convertLSToLF(char chars, int len) Convert text with generic line separators to line feeds (LF). | public static String | convertLSToLF(String text) Convert string with generic line separators to line feeds (LF). | public static char[] | createSpacesBuffer(int numSpaces) Get buffer of the requested size filled entirely with space character. | public static char[] | createWhiteSpaceFillBuffer(int startCol, int endCol, int tabSize) createWhitespaceFillBuffer() with the non-capital 's' should be used. | public static char[] | createWhitespaceFillBuffer(int startCol, int endCol, int tabSize) Get buffer filled with spaces/tabs so that it reaches from some column to
some other column. | public static boolean | endsWith(char[] chars, char[] suffix) | public static boolean | equals(String s, char[] chars) | public static boolean | equals(String s, char[] chars, int offset, int len) | public static char[] | extract(char[] chars, int offset, int len) | public static int | findFirstLFOffset(char[] chars, int offset, int len) | public static int | findFirstLFOffset(String s) | public static int | findFirstNonSpace(char[] chars, int offset, int len) | public static int | findFirstNonTab(char[] chars, int offset, int len) | public static int | findFirstNonWhite(char[] chars, int offset, int len) | public static int | findFirstTab(char[] chars, int offset, int len) | public static int | findFirstTabOrLF(char[] chars, int offset, int len) | public static int | findLastNonWhite(char[] chars, int offset, int len) | public static int | getColumn(char buffer, int offset, int len, int tabSize, int startCol) Get visual column. | public static String | getIndentString(int indent, boolean expandTabs, int tabSize) Get the string that should be used for indentation of the given level. | public static int | getLFCount(char chars) Count the number of line feeds in char array. | public static int | getLFCount(char chars, int offset, int len) | public static int | getLFCount(String s) | public static Object | getPlatformLS() | public static synchronized char[] | getSpacesBuffer(int numSpaces) Get buffer filled with appropriate number of spaces. | public static synchronized String | getSpacesString(int numSpaces) Get string filled with space characters. | public static char[] | getTabsBuffer(int numTabs) Get buffer filled with appropriate number of tabs. | public static String | getWhitespaceString(int startCol, int endCol, boolean expandTabs, int tabSize) Get the string that should be used for indentation of the given level. | public static void | initialRead(BaseDocument doc, Reader reader, boolean testLS) Do initial reading of document. | public static boolean | isSpace(String s) | public static boolean | isSpace(char[] chars, int offset, int len) | public static boolean | isWhitespace(char[] chars, int offset, int len) | public static char[] | loadFile(String fileName) Loads the file and performs conversion of line separators to LF. | static void | read(BaseDocument doc, Reader reader, int pos) | public static String | removeSpaces(String s) Remove all spaces from the given string. | public static void | reverse(char[] chars, int len) Reverses the order of characters in the array. | public static boolean | startsWith(char[] chars, char[] prefix) | public static String | testLS(char chars, int len) Test line separator on given semgment. | static void | write(BaseDocument doc, Writer writer, int pos, int len) |
EMPTY_CHAR_ARRAY | final public static char[] EMPTY_CHAR_ARRAY(Code) | | Empty char array
|
blocksHit | public static boolean blocksHit(int[] blocks, int startPos, int endPos)(Code) | | |
blocksIndex | public static int blocksIndex(int[] blocks, int startPos, int endPos)(Code) | | |
concat | public static char[] concat(char[] chars1, char[] chars2)(Code) | | |
convertLFToLS | public static int convertLFToLS(char[] src, int len, char[] tgt, String lsType)(Code) | | Convert text with LF line separators to text that uses line separators of
the document. This function is used when saving text into the file.
Segment's data are converted inside the segment's data or new segment's
data array is allocated. NOTE: Source segment must have just LFs as
separators! Otherwise the conversion won't work correctly.
Parameters: src - source chars to convert from Parameters: len - length of valid part of src data Parameters: tgt - target chars to convert to. The array MUST have twice the sizeof src otherwise index exception can be thrown Parameters: lsType - line separator type to be used i.e. LS_LF, LS_CR, LS_CRLF length of valid chars in tgt array |
convertLSToLF | public static int convertLSToLF(char chars, int len)(Code) | | Convert text with generic line separators to line feeds (LF). As the
linefeeds are one char long there is no need to allocate another buffer
since the only possibility is that the returned length will be smaller
than previous (if there were some CRLF separators.
Parameters: chars - char array with data to convert Parameters: len - valid portion of chars array new valid portion of chars array after conversion |
convertLSToLF | public static String convertLSToLF(String text)(Code) | | Convert string with generic line separators to line feeds (LF).
Parameters: text - string to convert new string with converted LSs to LFs |
createSpacesBuffer | public static char[] createSpacesBuffer(int numSpaces)(Code) | | Get buffer of the requested size filled entirely with space character.
Parameters: numSpaces - number of spaces in the returned character buffer. |
createWhiteSpaceFillBuffer | public static char[] createWhiteSpaceFillBuffer(int startCol, int endCol, int tabSize)(Code) | | createWhitespaceFillBuffer() with the non-capital 's' should be used.
|
createWhitespaceFillBuffer | public static char[] createWhitespaceFillBuffer(int startCol, int endCol, int tabSize)(Code) | | Get buffer filled with spaces/tabs so that it reaches from some column to
some other column.
Parameters: startCol - starting visual column of the whitespace on the line Parameters: endCol - ending visual column of the whitespace on the line Parameters: tabSize - size substituted visually for the '\t' character |
endsWith | public static boolean endsWith(char[] chars, char[] suffix)(Code) | | |
equals | public static boolean equals(String s, char[] chars)(Code) | | |
equals | public static boolean equals(String s, char[] chars, int offset, int len)(Code) | | |
extract | public static char[] extract(char[] chars, int offset, int len)(Code) | | |
findFirstLFOffset | public static int findFirstLFOffset(char[] chars, int offset, int len)(Code) | | |
findFirstLFOffset | public static int findFirstLFOffset(String s)(Code) | | |
findFirstNonSpace | public static int findFirstNonSpace(char[] chars, int offset, int len)(Code) | | Return the first index that is not space
|
findFirstNonTab | public static int findFirstNonTab(char[] chars, int offset, int len)(Code) | | Return the first index that is not space
|
findFirstNonWhite | public static int findFirstNonWhite(char[] chars, int offset, int len)(Code) | | Return the first index that is not space or tab or new-line char
|
findFirstTab | public static int findFirstTab(char[] chars, int offset, int len)(Code) | | |
findFirstTabOrLF | public static int findFirstTabOrLF(char[] chars, int offset, int len)(Code) | | |
findLastNonWhite | public static int findLastNonWhite(char[] chars, int offset, int len)(Code) | | Return the last index that is not space or tab or new-line char
|
getColumn | public static int getColumn(char buffer, int offset, int len, int tabSize, int startCol)(Code) | | Get visual column.
|
getIndentString | public static String getIndentString(int indent, boolean expandTabs, int tabSize)(Code) | | Get the string that should be used for indentation of the given level.
Parameters: indent - indentation level Parameters: expandTabs - whether tabs should be expanded to spaces or not Parameters: tabSize - size substituted visually for the '\t' character |
getLFCount | public static int getLFCount(char chars)(Code) | | Count the number of line feeds in char array.
number of LF characters contained in array. |
getLFCount | public static int getLFCount(char chars, int offset, int len)(Code) | | |
getPlatformLS | public static Object getPlatformLS()(Code) | | Get platform default line separator
|
getSpacesBuffer | public static synchronized char[] getSpacesBuffer(int numSpaces)(Code) | | Get buffer filled with appropriate number of spaces. The buffer can have
actually more spaces than requested.
Parameters: numSpaces - number of spaces |
getSpacesString | public static synchronized String getSpacesString(int numSpaces)(Code) | | Get string filled with space characters. There is optimization to return
the same string instance for up to ceratin number of spaces.
Parameters: numSpaces - number of spaces determining the resulting size of the string. |
getTabsBuffer | public static char[] getTabsBuffer(int numTabs)(Code) | | Get buffer filled with appropriate number of tabs. The buffer can have
actually more tabs than requested.
Parameters: numSpaces - number of spaces |
getWhitespaceString | public static String getWhitespaceString(int startCol, int endCol, boolean expandTabs, int tabSize)(Code) | | Get the string that should be used for indentation of the given level.
Parameters: indent - indentation level Parameters: expandTabs - whether tabs should be expanded to spaces or not Parameters: tabSize - size of the '\t' character |
initialRead | public static void initialRead(BaseDocument doc, Reader reader, boolean testLS) throws IOException(Code) | | Do initial reading of document. Translate any line separators found in
document to line separators used by document. It also cares for elements
that were already created on the empty document. Although the document
must be empty there can be already marks created. Initial read is
equivalent to inserting the string array of the whole document size at
position 0 in the document. Therefore all the marks that are not
insertAfter are removed and reinserted to the end of the document after
the whole initial read is finished.
Parameters: doc - document for which the initialization is performed Parameters: reader - reader from which document should be read Parameters: lsType - line separator type Parameters: testLS - test line separator of file and if it's consistent, use it Parameters: markDistance - the distance between the new syntax mark is put |
isSpace | public static boolean isSpace(char[] chars, int offset, int len)(Code) | | Return true if the array contains only space chars
|
isWhitespace | public static boolean isWhitespace(char[] chars, int offset, int len)(Code) | | Return true if the array contains only space or tab chars
|
loadFile | public static char[] loadFile(String fileName) throws IOException(Code) | | Loads the file and performs conversion of line separators to LF. This
method can be used in debuging of syntax scanner or somewhere else.
Parameters: fileName - the name of the file to load array of loaded characters with '\n' as line separator |
removeSpaces | public static String removeSpaces(String s)(Code) | | Remove all spaces from the given string.
Parameters: s - original string string with all spaces removed |
reverse | public static void reverse(char[] chars, int len)(Code) | | Reverses the order of characters in the array. It works from the begining
of the array, so no offset is given.
|
startsWith | public static boolean startsWith(char[] chars, char[] prefix)(Code) | | |
testLS | public static String testLS(char chars, int len)(Code) | | Test line separator on given semgment. This implementation simply checks
the first line of file but it can be redefined to do more thorough test.
Parameters: seg - segment where analyzes are performed line separator type found in the file |
|
|