Package net.sf.okapi.filters.openxml
Class YamlParameters
- java.lang.Object
-
- net.sf.okapi.common.BaseParameters
-
- net.sf.okapi.filters.openxml.YamlParameters
-
- All Implemented Interfaces:
IParameters,ISimplifierRulesParameters
public class YamlParameters extends BaseParameters implements ISimplifierRulesParameters
IParametersbased facade around the YAML configuration format. The parameters are read-only; calls to setXXX() are ignored.
-
-
Field Summary
-
Fields inherited from class net.sf.okapi.common.BaseParameters
path
-
Fields inherited from interface net.sf.okapi.common.ISimplifierRulesParameters
SIMPLIFIERRULES, SIMPLIFIERRULES_DISPLAY_NAME, SIMPLIFIERRULES_SHORT_DESC
-
-
Constructor Summary
Constructors Constructor Description YamlParameters()YamlParameters(File configFile)YamlParameters(String configAsString)YamlParameters(URL configPath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfromString(String data)Parses the parameters stored into a string back into the object.booleangetBoolean(String name)Gets the boolean value for the given parameter name.static StringgetDefualtParameterFile()intgetInteger(String name)Gets the integer value for a given parameter name.StringgetSimplifierRules()Get the code simplifier rules as defined bySimplifierRules(JavaCC file: core/simplifierrules/SimplifierRules.jj).StringgetString(String name)Gets the string value for a given parameter name.TaggedFilterConfigurationgetTaggedConfig()voidreset()Reset the parameters to their default values.voidsetBoolean(String name, boolean value)Sets the boolean value for a given parameter name.voidsetInteger(String name, int value)Sets the integer value for a given parameter name.voidsetSimplifierRules(String rules)Set the simplifier rules.voidsetString(String name, String value)Sets the string value for a given parameter name.voidsetTaggedConfig(TaggedFilterConfiguration taggedConfig)StringtoString()Converts the parameters into a string.voidvalidateSimplifierRules()Validate the current code simplifier rules.-
Methods inherited from class net.sf.okapi.common.BaseParameters
getParametersDescription, getPath, load, load, save, setPath
-
-
-
-
Method Detail
-
getDefualtParameterFile
public static String getDefualtParameterFile()
-
fromString
public void fromString(String data)
Description copied from interface:IParametersParses the parameters stored into a string back into the object.- Specified by:
fromStringin interfaceIParameters- Parameters:
data- the string holding the parameters. It must be formatted as the string generated by toString(). Line-breaks must be normalized to '\n'. It can also be null or empty, in such case the parameters are left with their current values. Use reset() to reset the parameters to their defaults.
-
toString
public String toString()
Description copied from interface:IParametersConverts the parameters into a string.- Specified by:
toStringin interfaceIParameters- Overrides:
toStringin classObject- Returns:
- the string holding all the parameters.
-
reset
public void reset()
Description copied from interface:IParametersReset the parameters to their default values.- Specified by:
resetin interfaceIParameters
-
getTaggedConfig
public TaggedFilterConfiguration getTaggedConfig()
-
setTaggedConfig
public void setTaggedConfig(TaggedFilterConfiguration taggedConfig)
- Parameters:
taggedConfig- new configuration
-
getBoolean
public boolean getBoolean(String name)
Description copied from interface:IParametersGets the boolean value for the given parameter name.- Specified by:
getBooleanin interfaceIParameters- Parameters:
name- the name of the boolean parameter to retrieve.- Returns:
- the value of the given parameter, or false if it is not defined.
-
setBoolean
public void setBoolean(String name, boolean value)
Description copied from interface:IParametersSets the boolean value for a given parameter name.- Specified by:
setBooleanin interfaceIParameters- Parameters:
name- the name of the parameter to set.value- the new value to set.
-
getString
public String getString(String name)
Description copied from interface:IParametersGets the string value for a given parameter name.- Specified by:
getStringin interfaceIParameters- Parameters:
name- the name of the string parameter to retrieve.- Returns:
- the value of the given parameter, or null if it is not defined.
-
setString
public void setString(String name, String value)
Description copied from interface:IParametersSets the string value for a given parameter name.- Specified by:
setStringin interfaceIParameters- Parameters:
name- the name of the parameter to set.value- the new value to set.
-
getInteger
public int getInteger(String name)
Description copied from interface:IParametersGets the integer value for a given parameter name.- Specified by:
getIntegerin interfaceIParameters- Parameters:
name- the name of the integer parameter to retrieve.- Returns:
- the value of the given parameter, or 0 if it is not defined.
-
setInteger
public void setInteger(String name, int value)
Description copied from interface:IParametersSets the integer value for a given parameter name.- Specified by:
setIntegerin interfaceIParameters- Parameters:
name- the name of the parameter to set.value- the new value to set.
-
getSimplifierRules
public String getSimplifierRules()
Description copied from interface:ISimplifierRulesParametersGet the code simplifier rules as defined bySimplifierRules(JavaCC file: core/simplifierrules/SimplifierRules.jj).- Specified by:
getSimplifierRulesin interfaceISimplifierRulesParameters- Returns:
- rules as a string.
-
setSimplifierRules
public void setSimplifierRules(String rules)
Description copied from interface:ISimplifierRulesParametersSet the simplifier rules.- Specified by:
setSimplifierRulesin interfaceISimplifierRulesParameters- Parameters:
rules- new simplifier rules
-
validateSimplifierRules
public void validateSimplifierRules() throws ParseExceptionDescription copied from interface:ISimplifierRulesParametersValidate the current code simplifier rules.- Specified by:
validateSimplifierRulesin interfaceISimplifierRulesParameters- Throws:
ParseException- if the rule cannot be parsed
-
-