Class FileNamingStrategy

java.lang.Object
edu.ie3.datamodel.io.naming.FileNamingStrategy

public class FileNamingStrategy extends Object
A naming strategy, that combines an EntityPersistenceNamingStrategy for naming entities and a FileHierarchy for a folder structure.
  • Constructor Details

    • FileNamingStrategy

      public FileNamingStrategy(EntityPersistenceNamingStrategy entityPersistenceNamingStrategy, FileHierarchy fileHierarchy)
      Constructor for building the file naming strategy.
      Parameters:
      entityPersistenceNamingStrategy - entity naming strategy
      fileHierarchy - directory hierarchy
    • FileNamingStrategy

      public FileNamingStrategy(EntityPersistenceNamingStrategy entityPersistenceNamingStrategy)
      Constructor for building the file naming strategy. Since no directory hierarchy is provided, a flat directory hierarchy is used.
      Parameters:
      entityPersistenceNamingStrategy - entity naming strategy
    • FileNamingStrategy

      public FileNamingStrategy()
      Constructor for building the file naming strategy. Since no entity naming strategy is provided, the entity naming strategy is used. Since no directory hierarchy is provided, a flat directory hierarchy is used.
  • Method Details

    • getFilePath

      public Optional<String> getFilePath(Class<? extends UniqueEntity> cls)
      Get the full path to the file with regard to some (not explicitly specified) base directory. The path does NOT start or end with any of the known file separators or file extension.
      Parameters:
      cls - Targeted class of the given file
      Returns:
      An optional sub path to the actual file
    • getFilePath

      public <T extends TimeSeries<E, V>, E extends TimeSeriesEntry<V>, V extends Value> Optional<String> getFilePath(T timeSeries)
      Get the full path to the file with regard to some (not explicitly specified) base directory. The path does NOT start or end with any of the known file separators or file extension.
      Type Parameters:
      T - Type of the time series
      E - Type of the entry in the time series
      V - Type of the value, that is carried by the time series entry
      Parameters:
      timeSeries - Time series to derive naming information from
      Returns:
      An optional sub path to the actual file
    • getDirectoryPath

      public Optional<String> getDirectoryPath(Class<? extends UniqueEntity> cls)
      Returns the sub directory structure with regard to some (not explicitly specified) base directory. The path does NOT start or end with any of the known file separators.
      Parameters:
      cls - Targeted class of the given file
      Returns:
      An optional sub directory path
    • getDirectoryPath

      public <T extends TimeSeries<E, V>, E extends TimeSeriesEntry<V>, V extends Value> Optional<String> getDirectoryPath(T timeSeries)
      Returns the sub directory structure with regard to some (not explicitly specified) base directory. The path does NOT start or end with any of the known file separators.
      Type Parameters:
      T - Type of the time series
      E - Type of the entry in the time series
      V - Type of the value, that is carried by the time series entry
      Parameters:
      timeSeries - Time series to derive naming information from
      Returns:
      An optional sub directory path
    • getIndividualTimeSeriesPattern

      public Pattern getIndividualTimeSeriesPattern()
      Returns the pattern to identify individual time series in this instance of the file naming strategy considering the EntityPersistenceNamingStrategy and FileHierarchy.
      Returns:
      An individual time series pattern
    • getLoadProfileTimeSeriesPattern

      public Pattern getLoadProfileTimeSeriesPattern()
      Returns the pattern to identify load profile time series in this instance of the file naming strategy considering the EntityPersistenceNamingStrategy and FileHierarchy.
      Returns:
      A load profile time series pattern
    • extractTimeSeriesMetaInformation

      @Deprecated(since="3.0", forRemoval=true) public FileNameMetaInformation extractTimeSeriesMetaInformation(Path path)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.0. Use timeSeriesMetaInformation(Path) instead.
      Extracts meta information from a file name, of a time series.
      Parameters:
      path - Path to the file
      Returns:
      The meeting meta information
    • timeSeriesMetaInformation

      public TimeSeriesMetaInformation timeSeriesMetaInformation(Path path)
      Extracts meta information from a file name, of a time series.
      Parameters:
      path - Path to the file
      Returns:
      The meeting meta information
    • extractTimeSeriesMetaInformation

      @Deprecated(since="3.0", forRemoval=true) public FileNameMetaInformation extractTimeSeriesMetaInformation(String fileName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 3.0. Use timeSeriesMetaInformation(String) instead.
      Extracts meta information from a file name, of a time series. Here, a file name without leading path has to be provided
      Parameters:
      fileName - File name
      Returns:
      The meeting meta information
    • timeSeriesMetaInformation

      public TimeSeriesMetaInformation timeSeriesMetaInformation(String fileName)
      Extracts meta information from a file name, of a time series. Here, a file name without leading path has to be provided
      Parameters:
      fileName - File name
      Returns:
      The meeting meta information
    • individualTimeSeriesMetaInformation

      public IndividualTimeSeriesMetaInformation individualTimeSeriesMetaInformation(String fileName)
    • removeFileNameEnding

      public static String removeFileNameEnding(String fileName)
    • getIdCoordinateEntityName

      public String getIdCoordinateEntityName()
      Get the entity name for coordinates
      Returns:
      the entity name string
    • getIdCoordinateFilePath

      public Optional<String> getIdCoordinateFilePath()
      Get the full path to the id coordinate file with regard to some (not explicitly specified) base directory. The path does NOT start or end with any of the known file separators or file extension.
      Returns:
      An optional sub path to the id coordinate file
    • getEntityName

      public Optional<String> getEntityName(Class<? extends UniqueEntity> cls)
      Returns the name of the entity, that should be used for persistence.
      Parameters:
      cls - Targeted class of the given file
      Returns:
      The name of the entity
    • getEntityName

      public <T extends TimeSeries<E, V>, E extends TimeSeriesEntry<V>, V extends Value> Optional<String> getEntityName(T timeSeries)
      Builds a file name (and only the file name without any directories and extension) of the given information.
      Type Parameters:
      T - Type of the time series
      E - Type of the entry in the time series
      V - Type of the value, that is carried by the time series entry
      Parameters:
      timeSeries - Time series to derive naming information from
      Returns:
      A file name for this particular time series