Package com.deltawalker.script
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 Summary
Modifier and TypeMethodDescriptionlongReturns the time this comparison was created.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.getName()Returns the name given to this comparison withsetName(String).String[]getPaths()Returns the paths of the resources of this comparison, indexed byRole.toInt(): element 0 isRole.REF, element 1 isRole.ONEand, in a three-way comparison, element 2 isRole.TWO.Role[]getRoles()Returns theRoles of the resources taking part in this comparison, an easy way to tell a two-way from a three-way comparison.Returns the settings of this comparison.getType()Returns the type of this comparison: folder, text or image.UriInfo[]Returns theUriInfos of the resources of this comparison, in the same order asgetPaths(): indexed byRole.toInt().voidSets the name of this comparison.
-
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 withsetName(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 byRole.toInt(): element 0 isRole.REF, element 1 isRole.ONEand, in a three-way comparison, element 2 isRole.TWO. Note that this order differs from the order of the paths passed toComparisons.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 theRoles 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 areRole.REFandRole.ONE; those of a three-way comparison areRole.ONE,Role.REFandRole.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 byApp.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 callingComparison.compare().- Returns:
- the
Settingsof 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 theUriInfos of the resources of this comparison, in the same order asgetPaths(): indexed byRole.toInt().- Returns:
- an array with one
UriInfoper role: two in a two-way comparison, three in a three-way comparison - Since:
- 2.0
-
setName
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 withComparisons.get(Object)orComparisons.createFromHistory(Object, ComparisonListener).- Parameters:
name- the new name; cannot benull- Throws:
NullPointerException- ifnameisnull- Since:
- 2.0
-