Interface HistoryEntry

All Known Subinterfaces:
Comparison, FileComparison, FolderComparison, ImageComparison, TextComparison

public interface HistoryEntry
An entry in the comparison history: information about a comparison that is sufficient to re-create it and run it the same way later.

A HistoryEntry is a lightweight object and cannot itself run a comparison. Its main use is examining the comparison history, as returned by Comparisons.getHistory(). An entry of interest can be turned into a full Comparison by passing its creation time or its name to Comparisons.createFromHistory(Object, ComparisonListener); the creation time, getCreationTime(), is the preferred way to identify an entry.

Every Comparison is also a HistoryEntry.


 const history = App.getComparisons().getHistory();
 for (let i = 0; i < history.length; i++) {
     const entry = history[i];
     console.log(entry.getDisplayCreationTime() + ' ' + entry.getType()
             + ' ' + entry.getName());
 }
 
  • Method Details

    • getCreationTime

      long getCreationTime()
      Returns the time this comparison was created.
      Returns:
      the time, measured in milliseconds since January 1, 1970, 00:00:00 GMT
      Since:
      2.0
    • getDisplayCreationTime

      String getDisplayCreationTime()
      Returns the time this comparison was created, formatted as shown in the DeltaWalker UI using the short date and time format of the current locale.
      Returns:
      the creation time as a display string
      Since:
      2.0
    • getName

      String getName()
      Returns the name given to this comparison with setName(String).
      Returns:
      the name, or an empty string if no name has been given
      Since:
      2.0
    • getPaths

      String[] getPaths()
      Returns the paths of the resources of this comparison, indexed by Role.toInt(): element 0 is Role.REF, element 1 is Role.ONE and, in a three-way comparison, element 2 is Role.TWO. Note that this order differs from the order of the paths passed to Comparisons.create(Comparison.Type, String[], ComparisonListener).
      Returns:
      an array with one path per role: two in a two-way comparison, three in a three-way comparison
      Since:
      2.0
    • getRoles

      Role[] getRoles()
      Returns the Roles of the resources taking part in this comparison, an easy way to tell a two-way from a three-way comparison. The roles of a two-way comparison are Role.REF and Role.ONE; those of a three-way comparison are Role.ONE, Role.REF and Role.TWO.
      
       const threeWay = comp.getRoles().length === 3;
       
      Returns:
      an array with the roles taking part in this comparison
      Since:
      2.0
    • getSettings

      Settings getSettings()
      Returns the settings of this comparison. There are two levels of settings: application-level settings, returned by App.getSettings(), and comparison-level settings. A comparison's settings start as a copy of the application defaults; after that, changes made to them apply to that comparison only. Comparison settings are saved with each comparison between DeltaWalker sessions.

      Values changed with Settings.set(com.deltopia.io.SettingKey, Object) do not by themselves start a new comparison; set them before calling Comparison.compare().

      Returns:
      the Settings of this comparison
      Since:
      2.0
    • getType

      Comparison.Type getType()
      Returns the type of this comparison: folder, text or image.
      Returns:
      the type of this comparison
      Since:
      2.0
      See Also:
    • getUriInfos

      UriInfo[] getUriInfos()
      Returns the UriInfos of the resources of this comparison, in the same order as getPaths(): indexed by Role.toInt().
      Returns:
      an array with one UriInfo per role: two in a two-way comparison, three in a three-way comparison
      Since:
      2.0
    • setName

      void setName(String name)
      Sets the name of this comparison. The name identifies the comparison in the list of comparisons and in its window tab, and makes it easy to find the comparison again later with Comparisons.get(Object) or Comparisons.createFromHistory(Object, ComparisonListener).
      Parameters:
      name - the new name; cannot be null
      Throws:
      NullPointerException - if name is null
      Since:
      2.0