Package net.sf.okapi.filters.wiki
Class Parameters
- java.lang.Object
-
- net.sf.okapi.common.BaseParameters
-
- net.sf.okapi.filters.wiki.Parameters
-
- All Implemented Interfaces:
Cloneable
,IParameters
,ISimplifierRulesParameters
public class Parameters extends BaseParameters implements ISimplifierRulesParameters
Custom parameter implementation backed by YAML. The normal parameter getters and setters are stubbed.
-
-
Field Summary
Fields Modifier and Type Field Description static String
WIKI_PARAMETERS
-
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 Parameters()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fromString(String data)
Parses the parameters stored into a string back into the object.boolean
getBoolean(String name)
Gets the boolean value for the given parameter name.IdentityHashMap<Pattern,Pattern>
getCustomCodePatterns()
int
getInteger(String name)
Gets the integer value for a given parameter name.String
getSimplifierRules()
Get the code simplifier rules as defined bySimplifierRules
(JavaCC file: core/simplifierrules/SimplifierRules.jj).String
getString(String name)
Gets the string value for a given parameter name.boolean
isPreserveWhitespace()
void
reset()
Reset the parameters to their default values.void
setBoolean(String name, boolean value)
Sets the boolean value for a given parameter name.void
setInteger(String name, int value)
Sets the integer value for a given parameter name.void
setSimplifierRules(String rules)
Set the simplifier rules.void
setString(String name, String value)
Sets the string value for a given parameter name.String
toString()
Converts the parameters into a string.void
validateSimplifierRules()
Validate the current code simplifier rules.-
Methods inherited from class net.sf.okapi.common.BaseParameters
getParametersDescription, getPath, load, load, save, setPath
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.okapi.common.IParameters
copy
-
-
-
-
Field Detail
-
WIKI_PARAMETERS
public static final String WIKI_PARAMETERS
- See Also:
- Constant Field Values
-
-
Method Detail
-
reset
public void reset()
Description copied from interface:IParameters
Reset the parameters to their default values.- Specified by:
reset
in interfaceIParameters
-
toString
public String toString()
Description copied from interface:IParameters
Converts the parameters into a string.- Specified by:
toString
in interfaceIParameters
- Overrides:
toString
in classObject
- Returns:
- the string holding all the parameters.
-
fromString
public void fromString(String data)
Description copied from interface:IParameters
Parses the parameters stored into a string back into the object.- Specified by:
fromString
in 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.
-
isPreserveWhitespace
public boolean isPreserveWhitespace()
-
getCustomCodePatterns
public IdentityHashMap<Pattern,Pattern> getCustomCodePatterns()
-
getBoolean
public boolean getBoolean(String name)
Description copied from interface:IParameters
Gets the boolean value for the given parameter name.- Specified by:
getBoolean
in 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:IParameters
Sets the boolean value for a given parameter name.- Specified by:
setBoolean
in 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:IParameters
Gets the string value for a given parameter name.- Specified by:
getString
in 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:IParameters
Sets the string value for a given parameter name.- Specified by:
setString
in 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:IParameters
Gets the integer value for a given parameter name.- Specified by:
getInteger
in 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:IParameters
Sets the integer value for a given parameter name.- Specified by:
setInteger
in interfaceIParameters
- Parameters:
name
- the name of the parameter to set.value
- the new value to set.
-
getSimplifierRules
public String getSimplifierRules()
Description copied from interface:ISimplifierRulesParameters
Get the code simplifier rules as defined bySimplifierRules
(JavaCC file: core/simplifierrules/SimplifierRules.jj).- Specified by:
getSimplifierRules
in interfaceISimplifierRulesParameters
- Returns:
- rules as a string.
-
setSimplifierRules
public void setSimplifierRules(String rules)
Description copied from interface:ISimplifierRulesParameters
Set the simplifier rules.- Specified by:
setSimplifierRules
in interfaceISimplifierRulesParameters
- Parameters:
rules
- new simplifier rules
-
validateSimplifierRules
public void validateSimplifierRules() throws ParseException
Description copied from interface:ISimplifierRulesParameters
Validate the current code simplifier rules.- Specified by:
validateSimplifierRules
in interfaceISimplifierRulesParameters
- Throws:
ParseException
- if the rule cannot be parsed
-
-