Class SubStringCount

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class SubStringCount
    extends AbstractTransformer
    Determines the position of a substring in the string passing through.
    The generated index is 1-based, with 0 indicating that the substring could not be located.

    Input/output:
    - accepts:
       java.lang.String
    - generates:
       java.lang.Integer


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: SubStringCount
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow gets stopped in case this actor encounters an error;
         useful for critical actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console.
        default: false
     
    -find <java.lang.String> (property: find)
        The sub-string to look for.
        default: 
     
    -from-index <adams.core.Index> (property: fromIndex)
        The index to start the search from.
        default: first
        example: An index is a number starting with 1; the following placeholders can be used as well: first, second, third, last_2, last_1, last
     
    -case-sensitive <boolean> (property: caseSensitive)
        If enabled, a case-sensitive search is performed.
        default: true
     
    -backward <boolean> (property: backward)
        If enabled, the search starts from the back rather than from the start of 
        the string.
        default: false
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Find

        protected String m_Find
        the sub-string to look for.
      • m_FromIndex

        protected Index m_FromIndex
        the starting index.
      • m_CaseSensitive

        protected boolean m_CaseSensitive
        whether to perform case-sensitive search.
      • m_Backward

        protected boolean m_Backward
        whether to start search from the back of the string.
    • Constructor Detail

      • SubStringCount

        public SubStringCount()
    • Method Detail

      • setFind

        public void setFind​(String value)
        Sets the sub-string to find.
        Parameters:
        value - the expression
      • getFind

        public String getFind()
        Returns the sub-string to find.
        Returns:
        the expression
      • findTipText

        public String findTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFromIndex

        public void setFromIndex​(Index value)
        Sets the index to start the search from.
        Parameters:
        value - the index
      • getFromIndex

        public Index getFromIndex()
        Returns the index to start the search from.
        Returns:
        the index
      • fromIndexTipText

        public String fromIndexTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setCaseSensitive

        public void setCaseSensitive​(boolean value)
        Sets whether to perform case-sensitive search.
        Parameters:
        value - true if to search case-sensitive
      • getCaseSensitive

        public boolean getCaseSensitive()
        Returns whether to perform case-sensitive search.
        Returns:
        true if case-sensitive search
      • caseSensitiveTipText

        public String caseSensitiveTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setBackward

        public void setBackward​(boolean value)
        Sets whether to start the search from the back rather than the front.
        Parameters:
        value - true if to search backwards
      • getBackward

        public boolean getBackward()
        Returns whether to start the search from the rather than the front.
        Returns:
        true if backwards search
      • backwardTipText

        public String backwardTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Returns:
        java.lang.String.class
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Returns:
        java.lang.Integer.class
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message