Package com.deltawalker.script
Interface DeltaNodeDetail
public interface DeltaNodeDetail
Details about how the resources of a
DeltaNode differ, returned by
DeltaNode.detail(Role[]):
- the
Comparison.Methods that found differences; - for
Comparison.Method.AS_TEXT, the numbers of added, deleted and changed blocks of text; - for
Comparison.Method.DATE_MODIFIED, the difference between the last-modified times.
Details are specific to each node. For instance, when comparing by
Comparison.Method.SIZE, Comparison.Method.DATE_MODIFIED and
Comparison.Method.ATTRIBUTES, the resources of one node may differ
by size only, so getMethod() returns [SIZE], while those of
another may differ by size and date, so getMethod() returns
[SIZE, DATE_MODIFIED].
const Delta = Java.type('com.deltawalker.script.Delta');
const detail = node.detail([Role.REF, Role.ONE]);
if (detail) {
const methods = detail.getMethod();
for (let m = 0; m < methods.length; m++) {
console.log('Differs by: ' + methods[m]);
}
console.log('Changed blocks: ' + detail.count([Delta.Kind.CHANGED]));
}
-
Method Summary
Modifier and TypeMethodDescriptionintcount(Delta.Kind[] kinds) When files are compared withComparison.Method.AS_TEXT, counts the blocks of text of the specifiedDelta.Kinds and returns the total.Returns theComparison.Methods that found differences.longReturns the difference between the last-modified times of the resources, when they were compared withComparison.Method.DATE_MODIFIED.
-
Method Details
-
count
When files are compared withComparison.Method.AS_TEXT, counts the blocks of text of the specifiedDelta.Kinds and returns the total. For example, if two files have 3 blocks of added text and 1 block of deleted text,count([Delta.Kind.ADDED])returns 3,count([Delta.Kind.DELETED])returns 1 andcount([Delta.Kind.ADDED, Delta.Kind.DELETED])returns 4.Delta.Kind.SAMEis not counted. For other comparison methods the counts are not tracked and are typically0.- Parameters:
kinds- the kinds to count; cannot benullor empty- Returns:
- the total number of blocks of the specified kinds
- Throws:
NullPointerException- ifkindsisnull.IllegalArgumentException- ifkindsis empty.
-
getMethod
Comparison.Method[] getMethod()Returns theComparison.Methods that found differences.For example, when comparing by
SIZE,DATE_MODIFIEDandATTRIBUTESand only the last-modified times differ, this method returns[DATE_MODIFIED].- Returns:
- an array of zero or more methods that found differences; never
null
-
getTimeDelta
long getTimeDelta()Returns the difference between the last-modified times of the resources, when they were compared withComparison.Method.DATE_MODIFIED.- Returns:
- the difference in milliseconds, or a negative value when not available
-