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 of StandardizerAction instances.

Groups of actions can be created using addActionToGroup(String, StandardizerAction) and addActionToGroups(Collection, StandardizerAction) methods. Note, that the StandardizerAction must be added to the configuration using addAction(StandardizerAction) or addActions(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 using InvalidStandardizerAction.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 method createErrorMessage(StandardizerConfiguration) .

IMPORTANT NOTE: The groups of the actions should be provided only after the actions are provided!

Since:
5.11
  • Constructor Details

    • StandardizerConfiguration

      public StandardizerConfiguration()
  • Method Details

    • 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 group
      action - 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 names
      action - the standardizer action
    • clone

      Overrides:
      clone in class Object
      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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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