Class SpreadSheetRandomSystematicSample

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

    public class SpreadSheetRandomSystematicSample
    extends AbstractSpreadSheetTransformer
    implements Randomizable, SpreadSheetViewCreator
    Performs random systematic sampling on the rows of the incoming spreadsheet.
    Divides the rows into N blocks with N being the sample size. Then chooses a random starting position. Adds the row the output increments the position by the sample size. Position wraps around if output hasn't yet reached sample size.
    For more information see:
    https://en.wikipedia.org/wiki/Systematic_sampling

    Input/output:
    - accepts:
       adams.data.spreadsheet.SpreadSheet
    - generates:
       adams.data.spreadsheet.SpreadSheet


    -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: SpreadSheetRandomSystematicSample
     
    -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 execution at this level gets stopped in case this
        actor encounters an error; the error gets propagated; useful for critical
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing
        actor handler must have this enabled as well.
        default: false
     
    -seed <long> (property: seed)
        The seed for the randomization
        default: 1
     
    -sample-size <int> (property: sampleSize)
        The size of the sample to use.
        default: 10
        minimum: 1
     
    -create-view <boolean> (property: createView)
        If enabled, then only a view of the subset is created.
        default: false
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Seed

        protected long m_Seed
        the seed for the randomization.
      • m_SampleSize

        protected int m_SampleSize
        the sample size.
      • m_CreateView

        protected boolean m_CreateView
        whether to create a view only.
    • Constructor Detail

      • SpreadSheetRandomSystematicSample

        public SpreadSheetRandomSystematicSample()
    • Method Detail

      • setSeed

        public void setSeed​(long value)
        Sets the seed value.
        Specified by:
        setSeed in interface Randomizable
        Parameters:
        value - the seed
      • getSeed

        public long getSeed()
        Returns the seed value.
        Specified by:
        getSeed in interface Randomizable
        Returns:
        the seed
      • seedTipText

        public String seedTipText()
        Returns the tip text for this property.
        Specified by:
        seedTipText in interface Randomizable
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSampleSize

        public void setSampleSize​(int value)
        Sets the sample size.
        Parameters:
        value - the size
      • getSampleSize

        public int getSampleSize()
        Returns the sample size.
        Returns:
        the size
      • sampleSizeTipText

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

        public void setCreateView​(boolean value)
        Sets whether to create a view only.
        Specified by:
        setCreateView in interface SpreadSheetViewCreator
        Parameters:
        value - true if to create a view only
      • getCreateView

        public boolean getCreateView()
        Returns whether to create only a view.
        Specified by:
        getCreateView in interface SpreadSheetViewCreator
        Returns:
        true if to create view only
      • createViewTipText

        public String createViewTipText()
        Returns the tip text for this property.
        Specified by:
        createViewTipText in interface SpreadSheetViewCreator
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doExecute

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