Class ProcessingUtil

    • Method Detail

      • dataTypes

        public static Set<String> dataTypes​(nl.minvenj.nfi.flits.api.Trace trace)
        Extract all data types of the data streams of given trace. It does this by filtering for all properties which start with the Constants.DATA_STREAM_NAME_PREFIX marker.
        Parameters:
        trace - the trace to extract the data types
        Returns:
        all data types of the contained data streams
      • hasDataStreamOfType

        public static boolean hasDataStreamOfType​(nl.minvenj.nfi.flits.api.Trace trace,
                                                  String dataType)
        Validate that given Trace contains a data stream of given type.
        Parameters:
        trace - the trace to test
        dataType - the type of the data stream to check for
        Returns:
        true if the trace contains the requested stream, otherwise false
      • dataStream

        public static byte[] dataStream​(nl.minvenj.nfi.flits.api.Trace trace,
                                        String dataType)
        Extract a data streams of given type from given trace.
        Parameters:
        trace - the trace to read the data stream from
        dataType - the type of the data to read
        Returns:
        the data stream as a byte array
      • createDataStreamPath

        public static Path createDataStreamPath​(Path rootTracePath,
                                                String tracePath,
                                                String dataType)
        Create a Path which points to the data stream file of the expected trace and type. The tracePath is a path which uniquely defines a single (child) trace.
        Parameters:
        rootTracePath - the path of the root trace JSON
        tracePath - a uniquely identifying path for current trace
        dataType - the data type of the stream
        Returns:
        a new path for given data stream file
      • extractFileName

        public static String extractFileName​(Path path)
        Return filename without extension from a given path.
        Parameters:
        path - path to a file
        Returns:
        filename without extension
      • getSearchTracesPath

        public static Path getSearchTracesPath​(Path tracePath)
        Return folder containing search traces given provided path to test trace.
        Parameters:
        tracePath - path to the trace being tested
        Returns:
        traces returned when querying
      • isFileWithExtension

        public static boolean isFileWithExtension​(Path filePath,
                                                  String extension)
        Return true if the extension filename located at path equals the provided extension.
        Parameters:
        filePath - path to file to check
        extension - extension to match
        Returns:
        true if matches
      • extractFileExtension

        public static String extractFileExtension​(Path filePath)
        Return extension of file at provided path.
        Parameters:
        filePath - path to file
        Returns:
        extension of file
      • searchTraceFromPath

        public static SearchTrace searchTraceFromPath​(Path tracePath)
        Create a search trace given the path to the file representing the search trace.
        Parameters:
        tracePath - Path to the search trace
        Returns:
        New SearchTrace