Package net.loomchild.segment.srx
Class SrxDocument
- java.lang.Object
-
- net.loomchild.segment.srx.SrxDocument
-
public class SrxDocument extends Object
Represents SRX document. Responsible for storing and searching matching language rules for given language code.- Author:
- loomchild
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_CASCADE
Default cascade value.
-
Constructor Summary
Constructors Constructor Description SrxDocument()
Creates empty document with default cascade.SrxDocument(boolean cascade)
Creates empty document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLanguageMap(String pattern, LanguageRule languageRule)
Add language map to this document.SrxDocumentCache
getCache()
boolean
getCascade()
List<LanguageMap>
getLanguageMapList()
List<LanguageRule>
getLanguageRuleList(String languageCode)
If cascade is true then returns all language rules matching given language code.void
setCascade(boolean cascade)
Sets if document is cascading or not.
-
-
-
Field Detail
-
DEFAULT_CASCADE
public static final boolean DEFAULT_CASCADE
Default cascade value.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SrxDocument
public SrxDocument(boolean cascade)
Creates empty document.- Parameters:
cascade
- true if document is cascading
-
SrxDocument
public SrxDocument()
Creates empty document with default cascade. SeeDEFAULT_CASCADE
.
-
-
Method Detail
-
setCascade
public void setCascade(boolean cascade)
Sets if document is cascading or not.- Parameters:
cascade
- true f document is cascading
-
getCascade
public boolean getCascade()
- Returns:
- true if document is cascading
-
addLanguageMap
public void addLanguageMap(String pattern, LanguageRule languageRule)
Add language map to this document.- Parameters:
pattern
- language code patternlanguageRule
-
-
getLanguageMapList
public List<LanguageMap> getLanguageMapList()
-
getLanguageRuleList
public List<LanguageRule> getLanguageRuleList(String languageCode)
If cascade is true then returns all language rules matching given language code. If cascade is false returns first language rule matching given language code. If no matching language rules are found returns empty list.- Parameters:
languageCode
- language code, for example en_US- Returns:
- matching language rules
-
getCache
public SrxDocumentCache getCache()
-
-