Class NewArray

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

    public class NewArray
    extends AbstractSimpleSource
    Generates a new array of the specified class with the given dimensions.
    Dimensions are given as follows: [x], with x being the number of elements. You can have multi-dimensional arrays: [x][y][z]. Variables can be used as well to specify the dimensions: [@{x}].

    Input/output:
    - generates:
       adams.flow.core.Unknown


    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to 
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: NewArray
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
     
    -stop-flow-on-error (property: stopFlowOnError)
        If set to true, the flow gets stopped in case this actor encounters an error;
         useful for critical actors.
     
    -array-class <java.lang.String> (property: arrayClass)
        The class to use for the array.
        default: java.lang.String
     
    -dimensions <adams.core.base.ArrayDimensions> (property: dimensions)
        The dimensions of the array; eg '[2]', '[2][3][7]', '[@{x}]'.
        default: [2]
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ArrayClass

        protected String m_ArrayClass
        the class for the array.
    • Constructor Detail

      • NewArray

        public NewArray()
    • Method Detail

      • setArrayClass

        public void setArrayClass​(String value)
        Sets the class for the array.
        Parameters:
        value - the classname, use empty string to use class of first element
      • getArrayClass

        public String getArrayClass()
        Returns the class for the array.
        Returns:
        the classname, empty string if class of first element is used
      • arrayClassTipText

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

        public void setDimensions​(ArrayDimensions value)
        Sets the dimensions of the array.
        Parameters:
        value - the dimensions
      • getDimensions

        public ArrayDimensions getDimensions()
        Returns the dimensions of the array.
        Returns:
        the dimensions
      • dimensionsTipText

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

        protected int[] parseDimensions​(String dim)
        Parses the dimensions.
        Parameters:
        dim - the dimension string
        Returns:
        the dimension array, null if failed to parse
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Returns:
        the Class of the generated tokens
      • doExecute

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