Interface DeltaNodeDetail


public interface DeltaNodeDetail
Details about how the resources of a DeltaNode differ, returned by DeltaNode.detail(Role[]):

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 Details

    • count

      int count(Delta.Kind[] kinds)
      When files are compared with Comparison.Method.AS_TEXT, counts the blocks of text of the specified Delta.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 and count([Delta.Kind.ADDED, Delta.Kind.DELETED]) returns 4. Delta.Kind.SAME is not counted. For other comparison methods the counts are not tracked and are typically 0.
      Parameters:
      kinds - the kinds to count; cannot be null or empty
      Returns:
      the total number of blocks of the specified kinds
      Throws:
      NullPointerException - if kinds is null.
      IllegalArgumentException - if kinds is empty.
    • getMethod

      Comparison.Method[] getMethod()
      Returns the Comparison.Methods that found differences.

      For example, when comparing by SIZE, DATE_MODIFIED and ATTRIBUTES and 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 with Comparison.Method.DATE_MODIFIED.
      Returns:
      the difference in milliseconds, or a negative value when not available