org.sbml.jsbml.validator
public class SyntaxChecker extends java.lang.Object
This utility class provides static methods for checking the syntax of
identifiers and other text used in an SBMLDocument
.
The methods allow callers to verify that String
s such as SBML
identifiers and XHTML notes text conform to the SBML specifications.
In order to save memory, all patterns in this class are only initialized upon their first use.
Modifier and Type | Field and Description |
---|---|
private java.util.regex.Pattern |
emailPattern
Definition of valid e-mail addresses.
|
private java.util.regex.Pattern |
metaIdPattern
Pattern to recognize valid meta-identifier strings for SBML elements.
|
private java.util.Set<java.lang.String> |
reservedNamesL1V1
Collection of reserved names that must not be used as identifiers (names)
in SBML documents in SBML Level 1 Version 1.
|
private java.util.Set<java.lang.String> |
reservedNamesL1V2
Collection of reserved names that must not be used as identifiers (names)
in SBML documents in SBML Level 1 Version 2.
|
private java.util.regex.Pattern |
SIdL2Pattern
Pattern to recognize valid SIds, i.e., identifier strings for SBML elements.
|
private java.util.regex.Pattern |
simpleMetaIdPattern
Pattern to recognize valid meta-identifier strings for SBML elements.
|
private java.util.regex.Pattern |
SNameL1V1
Name patterns for SBML Level 1 versions 1 and 2.
|
private java.util.regex.Pattern |
SNameL1V2
Name patterns for SBML Level 1 versions 1 and 2.
|
private static SyntaxChecker |
syntaxChecker
The only instance of this class.
|
Modifier | Constructor and Description |
---|---|
private |
SyntaxChecker()
This is a singleton class and should only be used through static methods.
|
Modifier and Type | Method and Description |
---|---|
private java.util.Set<java.lang.String> |
getReservedNamesL1V1() |
private void |
initL1V1SNamePattern()
Initializes the pattern for the type SName (described in SBML L1V1
specification, p.
|
private void |
initL1V2SNamePattern()
Creates the pattern for SName as defined in SBML specification for L1V2
page 7.
|
private void |
initMetaIdPatterns()
Build the pattern for metaIds according to the definition in SBML
L2V2R1 p.
|
private void |
initReservedNamesL1V1()
|
private void |
initReservedNamesL1V2() |
private void |
initSIdL2Pattern() |
static boolean |
isValidEmailAddress(java.lang.String email)
Definition of valid e-mail address
String s. |
static boolean |
isValidId(java.lang.String idCandidate,
int level,
int version)
Checks whether the given idCandidate is a valid identifier according to
the SBML specifications.
|
static boolean |
isValidMetaId(java.lang.String idCandidate)
Checks if the given identifier candidate satisfies the requirements for a
valid meta identifier (see SBML L2V4 p.
|
private static final SyntaxChecker syntaxChecker
private java.util.regex.Pattern emailPattern
private java.util.regex.Pattern metaIdPattern
private java.util.regex.Pattern simpleMetaIdPattern
private java.util.Set<java.lang.String> reservedNamesL1V1
private java.util.Set<java.lang.String> reservedNamesL1V2
private java.util.regex.Pattern SIdL2Pattern
private java.util.regex.Pattern SNameL1V1
private java.util.regex.Pattern SNameL1V2
private SyntaxChecker()
public static boolean isValidEmailAddress(java.lang.String email)
String
s.
Pattern | Explanation |
---|---|
^ | start of the line |
[_A-Za-z0-9-]+ | must start with string in the bracket [ ], must contains one or more (+) |
( | start of group #1 |
\\.[_A-Za-z0-9-]+ | follow by a dot "." and string in the bracket [ ], must contains one or more (+) |
)* | end of group #1, this group is optional (*) |
@ | must contains a "@" symbol |
[A-Za-z0-9-]+ | follow by string in the bracket [ ], must contains one or more (+) |
( | start of group #2 - first level TLD checking |
\\.[A-Za-z0-9-]+ | follow by a dot "." and string in the bracket [ ], must contains one or more (+) |
)* | end of group #2, this group is optional (*) |
( | start of group #3 - second level TLD checking |
\\.[A-Za-z]{2,} | follow by a dot "." and string in the bracket [ ], with minimum length of 2 |
) | end of group #3 |
$ | end of the line |
email
- public static final boolean isValidId(java.lang.String idCandidate, int level, int version)
idCandidate
- The String
to be tested.level
- Level of the SBML to be used.version
- Version of the SBML to be used.public static final boolean isValidMetaId(java.lang.String idCandidate)
idCandidate
- true
if the given argument is a valid meta identifier
String
, false
otherwise.private java.util.Set<java.lang.String> getReservedNamesL1V1()
private void initL1V1SNamePattern()
private void initL1V2SNamePattern()
private void initMetaIdPatterns()
private void initReservedNamesL1V1()
private void initReservedNamesL1V2()
private void initSIdL2Pattern()