Package com.e1c.langtool.storage.regex
Class RegExUtil
java.lang.Object
com.e1c.langtool.storage.regex.RegExUtil
The RegEx Utility class.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic RegExFilecreateRegExFile(TranslateLanguage language, org.eclipse.core.resources.IFile file, String segment) static StringgenerateComment(String segment) Generate comment for RegEx file.static StringGets the group name from presentation.static StringgetGroupPresentation(String group) Gets the group presentation.static StringgetGroupSource(Matcher matcher, String groupName) Gets the group source string.getNamedGroupCandidates(String regex) Gets the named group candidates from the RegEx string.static org.eclipse.core.resources.IFilegetRegExFilePath(org.eclipse.core.resources.IFile source, TranslateLanguage language, String segment) Gets the RegEx file path.getRegExGroups(RegExItem item) Gets the RegEx groups by the item and it's test string.getRegExGroups(RegExItem item, Matcher matcher) Gets the RegEx groups by the item and given external matcher.static RegExSettingsloadSettings(org.eclipse.core.resources.IFile file) static byte[]saveRegExSettings(RegExSettings settings, org.eclipse.core.resources.IFile file, com.google.common.hash.HashFunction hashFunction, org.eclipse.core.runtime.IProgressMonitor monitor) static voidsaveRegExSettings(RegExSettings settings, org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor)
-
Field Details
-
REG_EX_FILE_EXTENSION
- See Also:
-
TRANS_FILE_COMMENT_PREFIX
- See Also:
-
-
Method Details
-
createRegExFile
public static RegExFile createRegExFile(TranslateLanguage language, org.eclipse.core.resources.IFile file, String segment) -
generateComment
Generate comment for RegEx file.- Parameters:
segment- the segment- Returns:
- the comment for RegEx file
-
getRegExFilePath
public static org.eclipse.core.resources.IFile getRegExFilePath(org.eclipse.core.resources.IFile source, TranslateLanguage language, String segment) Gets the RegEx file path.- Parameters:
source- the sourcelanguage- the languagesegment- the segment- Returns:
- the RegEx file path
-
getNamedGroupCandidates
Gets the named group candidates from the RegEx string.- Parameters:
regex- the RegEx string- Returns:
- the named group candidates
-
getRegExGroups
Gets the RegEx groups by the item and it's test string.- Parameters:
item- the item- Returns:
- the RegEx groups
-
getRegExGroups
Gets the RegEx groups by the item and given external matcher.- Parameters:
item- the itemmatcher- the matcher- Returns:
- the RegEx groups
-
getGroupPresentation
Gets the group presentation."group" -> "${group}"- Parameters:
group- the group name- Returns:
- the group presentation
-
getGroupNameFromPresentation
Gets the group name from presentation."${group}" -> "group"- Parameters:
group- the group- Returns:
- the group name from presentation, or
nullif group presentation is not valid
-
getGroupSource
Gets the group source string.- Parameters:
matcher- the matchergroupName- the group presentation name- Returns:
- the group source
-
saveRegExSettings
public static void saveRegExSettings(RegExSettings settings, org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException - Throws:
IOException
-
saveRegExSettings
public static byte[] saveRegExSettings(RegExSettings settings, org.eclipse.core.resources.IFile file, com.google.common.hash.HashFunction hashFunction, org.eclipse.core.runtime.IProgressMonitor monitor) throws IOException - Throws:
IOException
-
loadSettings
-