public class RegexParser extends Object implements TagValueParser
A TagValueParser that splits a line based upon a regular expression. There are configuration parameters analgous to those in LineSplitParser for configuring parsing details.
EMPTY_LINE_EOR
Constructor and Description |
---|
RegexParser()
Create a new RegexParser with all boolean values set to false.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getContinueOnEmptyTag()
Report whether empty tags will be treated as continuations of the last non
-empty tag.
|
String |
getEndOfRecord()
Get the explicit end-of-record string.
|
boolean |
getMergeSameTag()
Report whether empty tags will be treated as continuations of the last non
-empty tag.
|
Pattern |
getPattern()
Get the Pattern currently used to split lines.
|
int |
getTagGroup()
Get the group number that matches the tag.
|
boolean |
getTrimTag()
See if trimming of tags is enabled.
|
boolean |
getTrimValue()
See if trimming of values is enabled.
|
int |
getValueGroup()
Get the group number that matches the value.
|
TagValue |
parse(Object o) |
void |
setContinueOnEmptyTag(boolean continueOnEmptyTag)
Decide whether to treat empty tags as continuations of the previous non
-empty tag.
|
void |
setEndOfRecord(String endOfRecord)
Set the explicit end-of-record string.
|
void |
setMergeSameTag(boolean mergeSameTag)
Decide if multiple examples of a single tag should be merged into a single
start/endTag pair with multiple values, or multiple start/endTag pairs each
with a single value.
|
void |
setPattern(Pattern pattern)
Set the Pattern used to split lines.
|
void |
setTagGroup(int group)
Set the group number that will match the tag.
|
void |
setTrimTag(boolean trimTag)
Enable trimming of the tag using String.trim().
|
void |
setTrimValue(boolean trimValue)
Enable trimming of the value using String.trim().
|
void |
setValueGroup(int group)
Set the group number that will match the value.
|
public RegexParser()
public void setPattern(Pattern pattern)
pattern
- the Pattern used to split linespublic Pattern getPattern()
public void setTagGroup(int group)
group
- the tag group numberpublic int getTagGroup()
public void setValueGroup(int group)
group
- the value group numberpublic int getValueGroup()
public void setEndOfRecord(String endOfRecord)
endOfRecord
- the new endOfRecord Stringpublic String getEndOfRecord()
public void setTrimTag(boolean trimTag)
trimTag
- true if tags should be trimmed, false otherwisepublic boolean getTrimTag()
public void setTrimValue(boolean trimValue)
trimValue
- true if values should be trimmed, false otherwisepublic boolean getTrimValue()
public void setContinueOnEmptyTag(boolean continueOnEmptyTag)
continueOnEmptyTag
- true if empty tags should be replaced, false
otherwisepublic boolean getContinueOnEmptyTag()
public void setMergeSameTag(boolean mergeSameTag)
mergeSameTag
- true if tags will be merged, false otherwisepublic boolean getMergeSameTag()
public TagValue parse(Object o) throws ParserException
parse
in interface TagValueParser
ParserException
Copyright © 2020 BioJava. All rights reserved.