Class AbstractInstanceGenerator<T extends DataContainer & ReportHandler>

    • Field Detail

      • m_OutputHeader

        protected weka.core.Instances m_OutputHeader
        the generated header.
      • m_AddDatabaseID

        protected boolean m_AddDatabaseID
        whether to add the database ID.
      • m_TolerateHeaderChanges

        protected boolean m_TolerateHeaderChanges
        whether to tolerate header changes.
      • m_Offline

        protected boolean m_Offline
        whether to operate in offline mode.
    • Constructor Detail

      • AbstractInstanceGenerator

        public AbstractInstanceGenerator()
    • Method Detail

      • reset

        protected void reset()
        Resets the generator (but does not clear the input data!). Derived classes must call this method in set-methods of parameters to assure the invalidation of previously generated data.
        Overrides:
        reset in class AbstractOptionHandler
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory. Sets the input data to null.
        Specified by:
        cleanUp in interface CleanUpHandler
      • setAddDatabaseID

        public void setAddDatabaseID​(boolean value)
        Sets whether the database ID is added to the data or not.
        Parameters:
        value - true if database ID should be added
      • getAddDatabaseID

        public boolean getAddDatabaseID()
        Returns whether the database ID is added.
        Returns:
        true if database ID is added
      • addDatabaseIDTipText

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

        public void setOffline​(boolean value)
        Sets whether to operate in offline mode.
        Specified by:
        setOffline in interface OptionalDatabaseConnectionUser
        Parameters:
        value - true if to operate in offline mode
      • getOffline

        public boolean getOffline()
        Returns whether the generator operates in offline mode.
        Specified by:
        getOffline in interface OptionalDatabaseConnectionUser
        Returns:
        true if operating in offline mode
      • offlineTipText

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

        public void setTolerateHeaderChanges​(boolean value)
        Sets whether to tolerate header changes and merely re-generating the header instead of throwing an exception.
        Parameters:
        value - true if to tolerate header changes
      • getTolerateHeaderChanges

        public boolean getTolerateHeaderChanges()
        Returns whether to tolerate header changes and merely re-generating the header instead of throwing an exception.
        Returns:
        true if to tolerate header changes
      • tolerateHeaderChangesTipText

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

        protected abstract AbstractDatabaseConnection getDefaultDatabaseConnection()
        Returns the default database connection.
        Returns:
        the default database connection
      • getOutputHeader

        public weka.core.Instances getOutputHeader()
        Returns the current header.
        Returns:
        the header, can be null
      • checkSetup

        public String checkSetup()
        Checks whether the setup is consistent.

        Default implementation does nothing.
        Returns:
        null if everything OK, otherwise the error message
      • generate

        public weka.core.Instance generate​(T data)
        Returns the generated data, generates it if necessary.
        Parameters:
        data - the profile to turn into an instance
        Returns:
        the generated data
      • checkInput

        protected void checkInput​(T data)
        Checks the input profile.

        The default implementation only checks whether there is any data set.
        Parameters:
        data - the data to process
      • checkHeader

        protected abstract void checkHeader​(T data)
        Checks whether the number of waves are the same.
        Parameters:
        data - the input data
      • generateHeader

        protected abstract void generateHeader​(T data)
        Generates the header of the output data.
        Parameters:
        data - the input data
      • interpretePosition

        protected String interpretePosition​(weka.core.Instances data,
                                            String position)
        Interpretes the position string based on the given dataset. "first", "second", "third", "last-2", "last-1" and "last" and "last+1" are valid as well.
        Parameters:
        data - the data to base the intepretation on
        position - the position string
        Returns:
        the numeric position string
      • postProcessHeader

        protected void postProcessHeader​(T data)
        Adds IDs, notes, additional fields to header.
        Parameters:
        data - the input data
      • generateOutput

        protected abstract weka.core.Instance generateOutput​(T data)
        Generates the actual data.
        Parameters:
        data - the input data to transform
        Returns:
        the generated data
      • postProcessOutput

        protected weka.core.Instance postProcessOutput​(T data,
                                                       weka.core.Instance inst)
        For adding IDs, notes, additional fields to the data.
        Parameters:
        data - the input data
        inst - the generated instance
        Returns:
        the processed instance
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

        Only compares the commandlines of the two objects.
        Specified by:
        compareTo in interface Comparable<T extends DataContainer & ReportHandler>
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.

        Only compares the commandlines of the two objects.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one
      • getGenerators

        public static String[] getGenerators()
        Returns a list with classnames of generators.
        Returns:
        the generator classnames
      • forName

        public static AbstractInstanceGenerator forName​(String classname,
                                                        String[] options)
        Instantiates the generator with the given options.
        Parameters:
        classname - the classname of the generator to instantiate
        options - the options for the generator
        Returns:
        the instantiated generator or null if an error occurred
      • forCommandLine

        public static AbstractInstanceGenerator forCommandLine​(String cmdline)
        Instantiates the generator from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the generator to instantiate
        Returns:
        the instantiated generator or null if an error occurred