TreeUtils Class

Module: BinaryUtils

TreeUtils used to compare Tree.

Can also be used to compare Object structure.

Item Index

Methods

Methods

compare

(
  • oldTree
  • newTree
  • diffs
  • pathOldTree
  • pathNewTree
)
Array static

Compare two trees and return list of changes.

oldTree is compared to newTree. The list of changes indicate wath needs to be changed in oldTree to become wqual to the newTree.

Elements inside Trees are compared using their UUID.

The array returned from this method contains objects in the format {status:, uuid: , from: , to: }

Parameters:

  • oldTree Tree

    Old version of Tree.

  • newTree Tree

    New version of Tree.

  • diffs Array

    Recursive parameter (optional).

  • pathOldTree Array

    Recursive parameter (optional).

  • pathNewTree Array

    Recursive parameter (optional).

Returns:

Array:

Array with diffs between oldTree and newTree.

Attributes

DIFF_ADDED

Number

Flag used to indicate ADDED diff.

DIFF_MOVED

Number

Flag used to indicate MOVED diff.

DIFF_REMOVED

Number

Flag used to indicate REMOVED diff.