Class CommitProcessTime

java.lang.Object
org.variantsync.diffdetective.analysis.CommitProcessTime

public class CommitProcessTime extends Object
Stores the time it took to process a single commit in a given repository in milliseconds.
Author:
Paul Bittner
  • Field Details

  • Constructor Details

    • CommitProcessTime

      public CommitProcessTime(String hash, String reponame, long milliseconds)
      Creates a new CommitProcessTime that stores that the commit the given has in the given repository took the given amount of milliseconds to process.
      Parameters:
      hash - The hash of the commit that was processed.
      reponame - The name of the repository from which the commit was taken.
      milliseconds - The time in milliseconds that were required to process the given commit.
  • Method Details

    • Invalid

      public static CommitProcessTime Invalid(String repoName)
      Creates an invalid count for the given repo. You may want to use this when no commits where analyzed at all.
      Parameters:
      repoName - Name of the repository for which to create an invalid commit time.
      Returns:
      A commit process time that does not refer to any commit and reports an illegal amount of milliseconds.
    • Unknown

      public static CommitProcessTime Unknown(String repoName, long milliseconds)
      Creates an count for an unkown commit in the given repository. You may want to use this when you need an initial value for a variable.
      Parameters:
      repoName - Name of the repository for which to create an unknown commit time.
      Returns:
      milliseconds The time in milliseconds that were required to process the unknown commit.
    • set

      public void set(String hash, long milliseconds)
      Resets this commit time to the given commit hash and milliseconds.
      Parameters:
      hash - The hash of the commit that was processed.
      milliseconds - The time in milliseconds that were required to process the given commit.
    • set

      public void set(String hash, String reponame, long milliseconds)
      Completely resets this commit time.
      Parameters:
      hash - The hash of the commit that was processed.
      reponame - The name of the repository from which the commit was taken.
      milliseconds - The time in milliseconds that were required to process the given commit.
    • set

      public void set(CommitProcessTime other)
      Sets all values of this object to the values of the given time. Both objects can be seen as semantically equivalent afterwards.
      Parameters:
      other - Other time whose value to copy into this one.
    • hash

      public String hash()
      Returns the commit hash.
      Returns:
      the commit hash.
    • milliseconds

      public long milliseconds()
      The amount of milliseconds that were required to process this commit.
      Returns:
      the amount of milliseconds that were required to process this commit.
    • min

      Computes the minimum of two CommitProcessTimes.
      Parameters:
      a - First argument.
      b - Second argument.
      Returns:
      Minimum of the given two times regarding the milliseconds().
    • max

      Computes the maximum of two CommitProcessTimes.
      Parameters:
      a - First argument.
      b - Second argument.
      Returns:
      Maximum of the given two times regarding the milliseconds().
    • fromString

      public static CommitProcessTime fromString(String text)
      Parses a CommitProcessTime from a string that was produced by toString().
      Parameters:
      text - The text to parse to a commit process timeĀ“.
      Returns:
      The parsed CommitProcessTime.
      Throws:
      AssertionError - When the input is ill-formed.
    • toString

      public String toString()
      Overrides:
      toString in class Object