Class TrackRepository

java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_data.TrackRepository

public class TrackRepository extends Object
Track repository which lists all different tracks in possibly multiple versions.
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • definedTracks

      private static Set<Track> definedTracks
    • trackNameAndVersionToTrack

      private static Map<String,Track> trackNameAndVersionToTrack
  • Constructor Details

    • TrackRepository

      public TrackRepository()
  • Method Details

    • setCacheFolder

      public static void setCacheFolder(File directory)
      Folder where the tracks and the corresponding test cases shall be cached. This is just a forward call to Track.setCacheFolder but in TrackRepository, this function also makes sense.
      Parameters:
      directory - caching directory.
    • getDefinedTracks

      public static Set<Track> getDefinedTracks()
      This method returns all tracks defined in TrackRepository with java reflections. It uses all public static fields (of type Track or Collection of Track) in all nested classes. This method further caches the tracks and do not execute the reflection each and every time.
      Returns:
      a set of Tracks defined in this class.
    • getMapFromTrackNameAndVersionToTrack

      public static Map<String,Track> getMapFromTrackNameAndVersionToTrack()
      Return a map between track name and version and the track object. This is used to find tracks when loading from file.
      Returns:
      map between track name, version and the track object
    • retrieveDefinedTracks

      public static Set<Track> retrieveDefinedTracks(Class<?>... initialClasses)
      This method retrieves all tracks defined in the provided classes or any subclass of it. It searches for fields which are defined as public static and has the type track or any collection of type track.
      Parameters:
      initialClasses - the initial class to search defined tracks in it.
      Returns:
      a set of tracks which are defined in
    • retrieveDefinedTrackList

      static List<Track> retrieveDefinedTrackList(Class<?>... initialClasses)
    • generateTestCaseWithSampledReferenceAlignment

      private static TestCase generateTestCaseWithSampledReferenceAlignment(TestCase tc, double fraction, Random randomSeed, boolean removeSamplesFromReference)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment.
      Parameters:
      tc - the base test case to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed object. If it is always in the same state e.g. always providing a fresh instance with the same seed like new Random(1234) or setting the seed of one random instance always to the same value, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      removeSamplesFromReference - if true, the reference (for evaluation) will only contain the correspondences which are not in the input alignment. If false, all correspondences will be evaluated (also those which are in the input alignment). This means that the eval will also check if the matcher remembers the input alignment.
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTestCaseWithSampledReferenceAlignment

      public static TestCase generateTestCaseWithSampledReferenceAlignment(TestCase tc, double fraction, long randomSeed, boolean removeSamplesFromReference)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment.
      Parameters:
      tc - the base test case to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      removeSamplesFromReference - if true, the reference (for evaluation) will only contain the correspondences which are not in the input alignment. If false, all correspondences will be evaluated (also those which are in the input alignment). This means that the eval will also check if the matcher remembers the input alignment.
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTestCaseWithSampledReferenceAlignment

      public static TestCase generateTestCaseWithSampledReferenceAlignment(TestCase tc, double fraction, long randomSeed)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment. The other fraction is used as the new reference alignment. This means it will be only evaluated what is not in the input alignment. If you want to evaluate on the whole reference alignment (inclusive the input alignment) call generateTestCaseWithSampledReferenceAlignment(TestCase, double, java.util.Random, boolean) with the last parameter to be false.
      Parameters:
      tc - the base test case to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTestCaseWithSampledReferenceAlignment

      public static TestCase generateTestCaseWithSampledReferenceAlignment(TestCase tc, double fraction)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment. The other fraction is used as the new reference alignment. This means it will be only evaluated what is not in the input alignment. If you want to evaluate on the whole reference alignment (inclusive the input alignment) call generateTestCaseWithSampledReferenceAlignment(TestCase, double, java.util.Random, boolean) with the last parameter to be false. The seed for randomness will be generated and the reference alignment contains only correspondences which are not in the input alignment.
      Parameters:
      tc - the base test case to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      private static List<TestCase> generateTrackWithSampledReferenceAlignment(List<TestCase> testCases, double fraction, Random randomSeed, boolean removeSamplesFromReference)
      Generates test cases where the input alignment of the test cases is filled with a fraction of the reference alignment.
      Parameters:
      testCases - the testcases to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      removeSamplesFromReference - if true, the reference (for evaluation) will only contain the correspondences which are not in the input alignment. If false, all correspondences will be evaluated (also those which are in the input alignment). This means that the eval will also check if the matcher remembers the input alignment.
      Returns:
      the test cases with same parameters as the base test cases but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      public static List<TestCase> generateTrackWithSampledReferenceAlignment(List<TestCase> testCases, double fraction, long randomSeed, boolean removeSamplesFromReference)
      Generates test cases where the input alignment of the test cases is filled with a fraction of the reference alignment.
      Parameters:
      testCases - the testcases to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      removeSamplesFromReference - if true, the reference (for evaluation) will only contain the correspondences which are not in the input alignment. If false, all correspondences will be evaluated (also those which are in the input alignment). This means that the eval will also check if the matcher remembers the input alignment.
      Returns:
      the test cases with same parameters as the base test cases but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      public static List<TestCase> generateTrackWithSampledReferenceAlignment(List<TestCase> testCases, double fraction, long randomSeed)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment. The other fraction is used as the new reference alignment. This means it will be only evaluated what is not in the input alignment. If you want to evaluate on the whole reference alignment (inclusive the input alignment) call generateTestCaseWithSampledReferenceAlignment(TestCase, double, java.util.Random, boolean) with the last parameter to be false.
      Parameters:
      testCases - the base test case to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      public static List<TestCase> generateTrackWithSampledReferenceAlignment(List<TestCase> testCases, double fraction)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment. The other fraction is used as the new reference alignment. This means it will be only evaluated what is not in the input alignment. If you want to evaluate on the whole reference alignment (inclusive the input alignment) call generateTestCaseWithSampledReferenceAlignment(TestCase, double, java.util.Random, boolean) with the last parameter to be false. The seed for randomness will be generated.
      Parameters:
      testCases - the base test case to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      public static List<TestCase> generateTrackWithSampledReferenceAlignment(Track track, double fraction, long randomSeed, boolean removeSamplesFromReference)
      Generates test cases where the input alignment of the test cases is filled with a fraction of the reference alignment.
      Parameters:
      track - the track to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      removeSamplesFromReference - if true, the reference (for evaluation) will only contain the correspondences which are not in the input alignment. If false, all correspondences will be evaluated (also those which are in the input alignment). This means that the eval will also check if the matcher remembers the input alignment.
      Returns:
      the test cases with same parameters as the base test cases but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      public static List<TestCase> generateTrackWithSampledReferenceAlignment(Track track, double fraction, long randomSeed)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment. The other fraction is used as the new reference alignment. This means it will be only evaluated what is not in the input alignment. If you want to evaluate on the whole reference alignment (inclusive the input alignment) call generateTestCaseWithSampledReferenceAlignment(TestCase, double, java.util.Random, boolean) with the last parameter to be false.
      Parameters:
      track - the track to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      randomSeed - the random seed number. If it is the same number, then a smaller subset (sample with 10 percent) will be contained in the larger subset (sample with 20 percent).
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.
    • generateTrackWithSampledReferenceAlignment

      public static List<TestCase> generateTrackWithSampledReferenceAlignment(Track track, double fraction)
      Generates a test case where the input alignment of the test case is filled with a fraction of the reference alignment. The other fraction is used as the new reference alignment. This means it will be only evaluated what is not in the input alignment. If you want to evaluate on the whole reference alignment (inclusive the input alignment) call generateTestCaseWithSampledReferenceAlignment(TestCase, double, java.util.Random, boolean) with the last parameter to be false. The seed for randomness will be generated.
      Parameters:
      track - the track to use.
      fraction - the fraction of the reference alignment ( a value between zero and one) which is provided as inputAlignment.
      Returns:
      the testcase with same parameters as the base test case but with a generated input alignment.