Package adams.data

Class DataUtils


  • public class DataUtils
    extends Object
    Helper class for data-related classes.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • DataUtils

        public DataUtils()
    • Method Detail

      • createFilename

        public static String createFilename​(File dir,
                                            String name,
                                            String extension)
        Generates a filename.
        Parameters:
        dir - the directory
        name - the name of the file (no path)
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename
      • createFilename

        public static String createFilename​(File dir,
                                            String name,
                                            String suffix,
                                            String extension)
        Generates a filename.
        Parameters:
        dir - the directory
        name - the name of the file (no path)
        suffix - an optional suffix to append before the extension, can be null
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename
      • createFilename

        public static String createFilename​(File dir,
                                            DatabaseIDHandler handler,
                                            String extension)
        Generates a filename for the handler.
        Parameters:
        dir - the directory
        handler - the handler to generate the filename for
        extension - the extension to add, including the dot
        Returns:
        the filename
      • createFilename

        public static String createFilename​(File dir,
                                            DatabaseIDHandler handler,
                                            String suffix,
                                            String extension)
        Generates a filename for the handler.
        Parameters:
        dir - the directory
        handler - the handler to generate the filename for
        suffix - an optional suffix to append before the extension, can be null
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename
      • createFilename

        public static String createFilename​(File dir,
                                            IDHandler handler,
                                            String extension)
        Generates a filename for the handler.
        Parameters:
        dir - the directory
        handler - the handler to generate the filename for
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename
      • createFilename

        public static String createFilename​(File dir,
                                            IDHandler handler,
                                            String suffix,
                                            String extension)
        Generates a filename for the handler.
        Parameters:
        dir - the directory
        handler - the handler to generate the filename for
        suffix - an optional suffix to append before the extension, can be null
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename
      • createFilename

        public static String createFilename​(File dir,
                                            Object handler,
                                            String extension)
        Generates a filename for the handler. Must be either an IDHandler or DatabaseIDHandler.
        Parameters:
        dir - the directory
        handler - the handler to generate the filename for
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename or null if not implementing correct interfaces
        See Also:
        IDHandler, DatabaseIDHandler
      • createFilename

        public static String createFilename​(File dir,
                                            Object handler,
                                            String suffix,
                                            String extension)
        Generates a filename for the handler. Must be either an IDHandler or DatabaseIDHandler.
        Parameters:
        dir - the directory
        handler - the handler to generate the filename for
        suffix - an optional suffix to append before the extension, can be null
        extension - the extension to add, including the dot, can be null
        Returns:
        the filename or null if not implementing correct interfaces
        See Also:
        IDHandler, DatabaseIDHandler