public class NewLineFilterFor extends Object
Convenience functions for creating line filters tailored for codelets.
aliteralmind __DASH__ github __AT__ yahoo __DOT__ com), dual-licensed under the LGPL (version 3.0 or later) or the ASL (version 2.0). See source code for details. http://codelet.aliteralmind.com, https://github.com/aliteralmind/codeletFilteredLineIterator| Modifier and Type | Method and Description |
|---|---|
static FilteredLineIterator |
eliminateAllCmtBlocksAndPackageLine(boolean doDelete_pkgDecl,
Appendable dbgPkgLnValidFilter_ifNonNull,
Appendable dbgPkgLnVldtr_ifNonNull,
boolean doElim_multiLineCmts,
Appendable dbgJavaMlcs_ifNotNull,
Appendable dbgAllLines_ifNonNull)
Eliminates the package declaration line and all multi-line comment blocks.
|
static FilteredLineIterator |
eliminateAllCmtBlocksAndPackageLine(CodeletInstance instance,
String named_debugPrefix,
boolean doDelete_pkgDecl,
boolean doElim_multiLineCmts)
Create a new eliminate-comment-blocks-and-package-line filter with named debuggers.
|
static FilteredLineIterator |
eliminateAllMultiLineComments(Appendable dbgJavaMlcs_ifNotNull,
Appendable dbgAllLines_ifNonNull)
Eliminates all multi-line comments, including the license and JavaDoc blocks.
|
static FilteredLineIterator |
eliminatePackageLine(Appendable dbgPkgLnValidFilter_ifNonNull,
Appendable dbgPkgLnVldtr_ifNonNull,
Appendable dbgAllLines_ifNonNull)
Eliminates the package declaration line.
|
static FilteredLineIterator |
lineRange(CodeletInstance instance,
String named_debugPrefix,
int startAppearance_num,
boolean is_startLineRegex,
String startLine_findWhat,
int endAppearance_num,
boolean is_endLineRegex,
String endLine_findWhat)
Create a new line-range filter with named debuggers.
|
static FilteredLineIterator |
lineRange(int startAppearance_num,
boolean is_startLineRegex,
String startLine_findWhat,
Appendable dbgStartFilter_ifNonNull,
Appendable dbgStart_ifNonNull,
int endAppearance_num,
boolean is_endLineRegex,
String endLine_findWhat,
Appendable dbgEndFilter_ifNonNull,
Appendable dbgEnd_ifNonNull,
Appendable dbgLineNums_ifNonNull,
Appendable dbgAllLines_ifNonNull,
LengthInRange rangeForEveryLineDebug_ifNonNull)
A code snippet: Keeps all lines in a specific range, based on the text existing in the first and last lines.
|
static FilteredLineIterator |
lineRangeWithReplace(CodeletInstance instance,
String named_debugPrefix,
int startAppearance_num,
boolean is_startLineRegex,
String startLine_findWhat,
String startLine_rplcWith,
ReplacedInEachInput startRplcs_notMtchNum,
int endAppearance_num,
boolean is_endLineRegex,
String endLine_findWhat,
String endLine_rplcWith,
ReplacedInEachInput endRplcs_notMtchNum)
Create a new line-range filter with named debuggers.
|
static FilteredLineIterator |
lineRangeWithReplace(int startAppearance_num,
boolean is_startLineRegex,
String startLine_findWhat,
String startLine_rplcWith,
ReplacedInEachInput startRplcs_notMtchNum,
Appendable dbgStartFilter_ifNonNull,
Appendable dbgStartRplcr_ifNonNull,
int endAppearance_num,
boolean is_endLineRegex,
String endLine_findWhat,
String endLine_rplcWith,
ReplacedInEachInput endRplcs_notMtchNum,
Appendable dbgEndFilter_ifNonNull,
Appendable dbgEndRplcr_ifNonNull,
Appendable dbgLineNums_ifNonNull,
Appendable dbgAllLines_ifNonNull,
LengthInRange rangeForEveryLineDebug_ifNonNull)
Keeps all lines in a specific range, based on the text existing in the first and last lines, making a replacement on the first and last lines only.
|
public static final FilteredLineIterator eliminateAllMultiLineComments(Appendable dbgJavaMlcs_ifNotNull, Appendable dbgAllLines_ifNonNull)
Eliminates all multi-line comments, including the license and JavaDoc blocks.
eliminateAllCmtBlocksAndPackageLine(false, null, null, true, dbgJavaMlcs_ifNotNull, dbgAllLines_ifNonNull)public static final FilteredLineIterator eliminatePackageLine(Appendable dbgPkgLnValidFilter_ifNonNull, Appendable dbgPkgLnVldtr_ifNonNull, Appendable dbgAllLines_ifNonNull)
Eliminates the package declaration line.
eliminateAllCmtBlocksAndPackageLine(true, dbgPkgLnValidFilter_ifNonNull, dbgPkgLnVldtr_ifNonNull, false, null, dbgAllLines_ifNonNull)public static final FilteredLineIterator eliminateAllCmtBlocksAndPackageLine(boolean doDelete_pkgDecl, Appendable dbgPkgLnValidFilter_ifNonNull, Appendable dbgPkgLnVldtr_ifNonNull, boolean doElim_multiLineCmts, Appendable dbgJavaMlcs_ifNotNull, Appendable dbgAllLines_ifNonNull)
Eliminates the package declaration line and all multi-line comment blocks.
doDelete_pkgDecl - If true, the package declaration line is eliminated. If false, the alterer is not created (line() is not called, and both dbgPkgLnValidFilter_ifNonNull and dbgPkgLnVldtr_ifNonNull are ignored). At least one boolean parameter must be true.doElim_multiLineCmts - If true, all multi-line comments are deleted. If false, allJavaMultiLineComments is not called (and dbgJavaMlcs_ifNotNull is ignored). Warning: This eliminates entire lines, including any text that happens to be outside of the block:
This text will also be eliminated /* The start of a comment...)eliminateAllCmtBlocksAndPackageLine(CodeletInstance, String, *),
eliminateAllMultiLineComments,
eliminatePackageLinepublic static final FilteredLineIterator eliminateAllCmtBlocksAndPackageLine(CodeletInstance instance, String named_debugPrefix, boolean doDelete_pkgDecl, boolean doElim_multiLineCmts)
Create a new eliminate-comment-blocks-and-package-line filter with named debuggers.
Named debuggers provided to the following eliminateAllCmtBlocksAndPackageLine parameters:
[named_debugPrefix].filter: dbgAllLines_ifNonNull.packageline: dbgPkgLnValidFilter_ifNonNull.packageline.validfilter: dbgPkgLnVldtr_ifNonNull.javamlcs: dbgJavaMlcs_ifNotNullPREFIX.filter=-1 PREFIX.filter.packageline=-1 PREFIX.filter.packageline.validfilter=-1 PREFIX.filter.javamlcs=-1
instance - For determining the current debugging level.named_debugPrefix - Prepended to all named debuggers. May not be null or empty.public static final FilteredLineIterator lineRange(int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, Appendable dbgStartFilter_ifNonNull, Appendable dbgStart_ifNonNull, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat, Appendable dbgEndFilter_ifNonNull, Appendable dbgEnd_ifNonNull, Appendable dbgLineNums_ifNonNull, Appendable dbgAllLines_ifNonNull, LengthInRange rangeForEveryLineDebug_ifNonNull) throws PatternSyntaxException
A code snippet: Keeps all lines in a specific range, based on the text existing in the first and last lines.
startAppearance_num - If the start-line search term is found on multiple lines, this is the desired occurance (if two, the second line the term is found on).is_startLineRegex - If true startLine_findWhat is treated as a regular expression. If false, literal.startLine_findWhat - The start-line search term. This is the text or pattern that exists in the first line that should be kept. May not be null or empty.endAppearance_num - If the end-line search term is found on multiple lines, this is the desired occurance. This is the appearance of the term in the entire document, including any appearances before the start line.is_endLineRegex - If true startLine_findWhat is treated as a regular expression.endLine_findWhat - The start-line search term.WherenewFilteredLineIterator( null,Returns.KEPT,KeepUnmatched.NO, dbgAllLines_ifNonNull, rangeForEveryLineDebug_ifNonNull, snippetBlock)
snippetBlock is a
andNewBlockEntityFor.lineRange("lineRange",KeepMatched.YES, startLinePattern, startAppearanceFilter, dbgStart_ifNonNull, endLinePattern, endAppearanceFilter, dbgEnd_ifNonNull,EntityRequired.YES, null, dbgLineNums_ifNonNull)
startAppearanceFilter is a
NewValidResultFilterFor.exactly( startAppearance_num, ..., dbgStartFilter_ifNonNull)
PatternSyntaxExceptionlineRange(CodeletInstance, ...),
lineRangeWithReplacepublic static final FilteredLineIterator lineRange(CodeletInstance instance, String named_debugPrefix, int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat) throws PatternSyntaxException
Create a new line-range filter with named debuggers.
Named debuggers provided to the following lineRange parameters:
[named_debugPrefix].filter.blockstart: dbgStart_ifNonNull.blockstart.validfilter: dbgStartFilter_ifNonNull.blockend: dbgEnd_ifNonNull.blockend.validfilter: dbgEndFilter_ifNonNull.linenums: dbgLineNums_ifNonNull.alllines: dbgAllLines_ifNonNullPREFIX.filter.alllines=-1 PREFIX.filter.blockend.validfilter=-1 PREFIX.filter.blockend=-1 PREFIX.filter.blockstart.validfilter=-1 PREFIX.filter.blockstart=-1 PREFIX.filter.linenums=-1
instance - For determining the current debugging level.named_debugPrefix - Prepended to all named debuggers. May not be null or empty.PatternSyntaxExceptionpublic static final FilteredLineIterator lineRangeWithReplace(int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, String startLine_rplcWith, ReplacedInEachInput startRplcs_notMtchNum, Appendable dbgStartFilter_ifNonNull, Appendable dbgStartRplcr_ifNonNull, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat, String endLine_rplcWith, ReplacedInEachInput endRplcs_notMtchNum, Appendable dbgEndFilter_ifNonNull, Appendable dbgEndRplcr_ifNonNull, Appendable dbgLineNums_ifNonNull, Appendable dbgAllLines_ifNonNull, LengthInRange rangeForEveryLineDebug_ifNonNull) throws PatternSyntaxException
Keeps all lines in a specific range, based on the text existing in the first and last lines, making a replacement on the first and last lines only. This is useful when lines must be marked, but those marks should not be seen in the final output.
For documentation on all other parameters, see lineRange.
startLine_rplcWith - The replacement term for the start-line search term (startLine_findWhat). May not be null or empty.startRplcs_notMtchNum - In most cases, this should be set to "FIRST". See com.github.xbn.regexutil.ReplacedInEachInput.endLine_rplcWith - The replacement term for the end-line search term (endLine_findWhat).endRplcs_notMtchNum - In most cases, this should be set to "FIRST".lineRange, with this alternative block entity:
NewBlockEntityFor.lineRangeWithReplace( "lineRangeWithReplace",KeepMatched.YES, startLinePattern, startLine_rplcWith, startRplcs_notMtchNum, startAppearanceFilter, dbgStartRplcr_ifNonNull, null, //No mid alterer endLinePattern, endLine_rplcWith, endRplcs_notMtchNum, endAppearanceFilter, dbgEndRplcr_ifNonNull,EntityRequired.YES, null, dbgLineNums_ifNonNull)
PatternSyntaxExceptionpublic static final FilteredLineIterator lineRangeWithReplace(CodeletInstance instance, String named_debugPrefix, int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, String startLine_rplcWith, ReplacedInEachInput startRplcs_notMtchNum, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat, String endLine_rplcWith, ReplacedInEachInput endRplcs_notMtchNum) throws PatternSyntaxException
Create a new line-range filter with named debuggers.
Named debuggers provided to the following lineRangeWithReplace parameters:
[named_debugPrefix].filter.blockstart: dbgStartRplcr_ifNonNull.blockstart.validfilter: dbgStartFilter_ifNonNull.blockend: dbgEndRplcr_ifNonNull.blockend.validfilter: dbgEndFilter_ifNonNull.linenums: dbgLineNums_ifNonNull.alllines: dbgAllLines_ifNonNullPREFIX.filter.alllines=-1PREFIX.filter.linenums=-1 PREFIX.filter.blockend.validfilter=-1 PREFIX.filter.blockend=-1 PREFIX.filter.blockstart.validfilter=-1 PREFIX.filter.blockstart=-1
instance - For determining the current debugging level.named_debugPrefix - Prepended to all named debuggers. May not be null or empty.PatternSyntaxExceptionCopyright 2014, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
https://github.com/aliteralmind/codelet