Class StandardizerConfiguration
- java.lang.Object
-
- chemaxon.standardizer.configuration.StandardizerConfiguration
-
- All Implemented Interfaces:
Cloneable
@PublicAPI public class StandardizerConfiguration extends Object implements Cloneable
Standardizer configuration class.
Contains a list ofStandardizerAction
instances.
Groups of actions can be created using
addActionToGroup(String, StandardizerAction)
andaddActionToGroups(Collection, StandardizerAction)
methods. Note, that theStandardizerAction
must be added to the configuration usingaddAction(StandardizerAction)
oraddActions(List)
prior added into a group.
The configuration may contain invalid actions, that could not be read from XML or action string configuration. In all cases these actions must be instances of
InvalidStandardizerAction
. In these cases the root cause of the error can be gathered usingInvalidStandardizerAction.getErrorMessage()
method.
The validity of the configuration can be checked by the function
isValid()
. If there are invalid standardizer actions in the configuration, this function returns true. A text representation of all errors contained by a configuration can be gathered by the static methodcreateErrorMessage(StandardizerConfiguration)
.
IMPORTANT NOTE: The groups of the actions should be provided only after the actions are provided!
- Since:
- 5.11
-
-
Constructor Summary
Constructors Constructor Description StandardizerConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(StandardizerAction action)
Adds an action to the configurationvoid
addActions(List<StandardizerAction> actions)
Adds actions to the configurationvoid
addActionToGroup(String group, StandardizerAction action)
Adds an action to the groupvoid
addActionToGroups(Collection<String> groups, StandardizerAction action)
Adds an action to a list of groupsvoid
clear()
Clears the configuration of actionStandardizerConfiguration
clone()
StandardizerConfiguration
cloneConfiguration()
Clones the configurationstatic String
createErrorMessage(StandardizerConfiguration configuration)
Creates an error message based on an invalid configurationint
getActionCount()
Gets the action count of the configurationList<Integer>
getActionIndexes(String actionString)
Gets the indexes of actions defined by the provided action stringList<StandardizerAction>
getActions()
Gets all actions of the configurationList<StandardizerAction>
getActions(String group)
Gets actions of a group of the configurationList<StandardizerAction>
getActions(String... groups)
Gets actions of a group of the configurationString
getGroupsOf(StandardizerAction action)
Gets the group names associated to an action separated by , characterint
getLastIndexOfAction(String token)
Gets the last index of an action defined by the provided action stringboolean
isEmpty()
Gets whether the configuration contains actionsboolean
isValid()
Gets whether the configuration contains only valid elementsvoid
removeAction(StandardizerAction action)
Removes an action of the configurationvoid
removeActions(Collection<StandardizerAction> actions)
Removes actions of the configurationString
toString()
-
-
-
Method Detail
-
addAction
public void addAction(StandardizerAction action)
Adds an action to the configuration- Parameters:
action
- the action to be added to the configuration
-
addActions
public void addActions(List<StandardizerAction> actions)
Adds actions to the configuration- Parameters:
actions
- the actions to be added to the configuration
-
removeAction
public void removeAction(StandardizerAction action)
Removes an action of the configuration- Parameters:
action
- the action to be removed to the configuration
-
removeActions
public void removeActions(Collection<StandardizerAction> actions)
Removes actions of the configuration- Parameters:
actions
- the actions to be removed to the configuration
-
getActions
public List<StandardizerAction> getActions()
Gets all actions of the configuration- Returns:
- all actions of the configuration
-
getActions
public List<StandardizerAction> getActions(String group)
Gets actions of a group of the configuration- Parameters:
group
- the name of the group (case sensitive)- Returns:
- actions of a group of the configuration
-
getActions
public List<StandardizerAction> getActions(String... groups)
Gets actions of a group of the configuration- Parameters:
groups
- the name of the group (case sensitive)- Returns:
- actions of a group of the configuration
-
addActionToGroup
public void addActionToGroup(String group, StandardizerAction action)
Adds an action to the group- Parameters:
group
- the name of the groupaction
- the standardizer action
-
addActionToGroups
public void addActionToGroups(Collection<String> groups, StandardizerAction action)
Adds an action to a list of groups- Parameters:
groups
- the list of the group namesaction
- the standardizer action
-
clone
public StandardizerConfiguration clone() throws CloneNotSupportedException
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
cloneConfiguration
public StandardizerConfiguration cloneConfiguration()
Clones the configuration- Returns:
- the clone of the configuration
-
isEmpty
public boolean isEmpty()
Gets whether the configuration contains actions- Returns:
- true is the configuration does not contains actions
-
clear
public void clear()
Clears the configuration of action
-
getActionCount
public int getActionCount()
Gets the action count of the configuration- Returns:
- the action count of the configuration
-
getLastIndexOfAction
public int getLastIndexOfAction(String token)
Gets the last index of an action defined by the provided action string- Parameters:
token
- the action string token of the action- Returns:
- the last index of an action defined by the provided action string
-
getActionIndexes
public List<Integer> getActionIndexes(String actionString)
Gets the indexes of actions defined by the provided action string- Parameters:
actionString
- the action string token of the task- Returns:
- indexes of actions defined by the provided action string
-
getGroupsOf
public String getGroupsOf(StandardizerAction action)
Gets the group names associated to an action separated by , character- Parameters:
action
- the target action- Returns:
- the groups associated to the action
-
isValid
public boolean isValid()
Gets whether the configuration contains only valid elements- Returns:
- true if the configuration contains only valid elements
-
createErrorMessage
public static String createErrorMessage(StandardizerConfiguration configuration)
Creates an error message based on an invalid configuration- Parameters:
configuration
- the base configuration- Returns:
- the proper error message for the configuration
-
-