public interface Delta
Delta
represents one or more relations/pairs of comparable entities
such as filesystem resources, blocks of text, XML nodes, and so on, as well
as the Delta.Kind
of delta/difference between the comparables in each pair.
For instance, in a 2way comparison there's only one relation/pair of
comparables, that between a comparable with Role.REF
and a comparable
with Role.ONE
, and there's only one Kind
of difference.
In a 3way comparison there are 3 relations:
Role#ONE
<> Role#REF
Role#REF
<> Role#TWO
Role#ONE
<> Role#TWO
and 3 Kind
s  one for each relation.
Therefore, in a 3way comparison it makes sense to talk about overall
comparison result  result which is the aggregate of the Kind
s
of the individual pairs. For instance, if the delta between Role#ONE
and Role#REF
is of Kind#ADDED
and there's no change between
Role#REF
and Role#TWO
, it can be said that the overall
comparison result is of Kind#ADDED
.
When there are changes in more than one pair of comparable they can be categorized as a conflict or as a pseudoconflict.
isConflict()
,
isPseudoConflict()
Modifier and Type  Interface and Description 

static class 
Delta.Kind 
Modifier and Type  Method and Description 

Delta[] 
getChildren()
Returns an array of
Delta s that are children of this item. 
Delta 
getParent()
Returns the parent
Delta of this delta. 
boolean 
hasChildren()
Answers whether [one or more of the elements/comparables of] this node
has children based on information available so far i.e.

boolean 
isAdded()
Checks whether the overall comparison result represented by this
Delta is of kind Delta.Kind.ADDED i.e. 
boolean 
isChanged()
Checks whether the overall comparison result represented by this
Delta is of kind Delta.Kind.CHANGED i.e. 
boolean 
isConflict()
In addition to the available 4
Delta.Kind s, in a 3way
comparison the overall comparison result can be categorized as a
conflict or as a pseudoconflict. 
boolean 
isDeleted()
Checks whether the overall comparison result represented by this
Delta is of kind Delta.Kind.DELETED i.e. 
boolean 
isOverallKind(Delta.Kind kind)
Checks whether the overall comparison result is of the specified
Delta.Kind . 
boolean 
isPseudoConflict()
Answers whether the overall comparison result represented by this
Delta instance is a pseudoconflict. 
boolean 
isSame()
Checks whether the overall comparison result represented by this
Delta is of kind Delta.Kind.SAME i.e. 
Delta.Kind 
kind(Role[] relation)
Returns the
Delta.Kind that corresponds to the specified relation i.e. 
Delta[] getChildren()
Delta
s that are children of this item. The
exact type of these items varies depending on the type of comparison.
When comparing text, the children are of type DeltaRange
and
represent differences inside linked/matching blocks of text, a.k.a inline
differences. When comparing folder hierarchies, the children are of type
DeltaNode
and represent the files and/or folders that belong to
this folder/node.Delta
objects. The array is empty
when there are no children.Delta getParent()
Delta
of this delta.
The exact type of the parent depends on the type of comparison: for
structurebased comparisons such as folder hierarchies and XML files this
Delta
and its parent are of type
DeltaNode
; for textbased comparison they
are of type DeltaRange
.
The parent can be null
in the following scenarios:
null
Delta
boolean hasChildren()
boolean isAdded()
Delta
is of kind Delta.Kind.ADDED
i.e. that all other delta
kinds, if any, are Delta.Kind.SAME
.true
if this difference is of type Kind#ADDED
,
false
otherwise.isOverallKind(Kind)
boolean isChanged()
Delta
is of kind Delta.Kind.CHANGED
i.e. that all other delta
kinds, if any, are Delta.Kind.SAME
.true
if this difference is of type Kind#CHANGED
,
false
otherwise.isOverallKind(Kind)
boolean isConflict()
Delta.Kind
s, in a 3way
comparison the overall comparison result can be categorized as a
conflict or as a pseudoconflict. A conflict is when both
Role.ONE
and Role.TWO
have changed relative to
Role.REF
and are different between each other. A pseudoconflict
is when Role.ONE
and Role.TWO
have changed in the same
way relative to Role.REF
i.e. they are the same when compared
with each other.
This method checks whether the overall comparison result represented by
this Delta
instance is a conflict.
true
if this difference is a conflict, false
otherwise.boolean isDeleted()
Delta
is of kind Delta.Kind.DELETED
i.e. that all other delta
kinds, if any, are Delta.Kind.SAME
.true
if this difference is of type Kind#DELETED
,
false
otherwise.isOverallKind(Kind)
boolean isOverallKind(Delta.Kind kind)
Delta.Kind
.
This information is important because most of the time one is interested
in the overall result of a comparison which, in a 3way comparison, can
include conflicts and pseudoconflicts. In the case of a
conflict or pseudoconflict this method returns false
when called
given any other Delta.Kind
because it checks that the specified
kind is the only real difference kind i.e. that all other kinds
are Delta.Kind.SAME
.
If you need to obtain the exact Delta.Kind
for a given relation,
use kind(Role[])
kind
 true
if the 'overall' Kind
of this Delta
is the same as the specified kind
.Delta
,
isConflict()
boolean isPseudoConflict()
Delta
instance is a pseudoconflict.true
if this difference is a pseudoconflict,
false
otherwise.isConflict()
boolean isSame()
Delta
is of kind Delta.Kind.SAME
i.e. that all other delta
kinds, if any, are Delta.Kind.SAME
.true
if this difference is of type Kind#SAME
,
false
otherwise.isOverallKind(Kind)
Delta.Kind kind(Role[] relation)
Delta.Kind
that corresponds to the specified relation i.e.
pair of comparables. In a 2way comparison there's only one relation 
Role.REF
<> Role.ONE
. In a threeway comparison there
are three relations: Role.REF
<> Role.ONE
,
Role.REF
<>Role.TWO
and Role.ONE
<>
Role.TWO
and this method offers access to the specific delta kind
of all possible relations.
Most often however, one is interested in the overall/aggregate
Delta.Kind
, that is, the kind resulting from taking all the
individual kinds into account. Use the methods beginning with isXyz() to
obtain the overall kind for a delta; the overall kind is also the kind
that will be reported by the UI.
To reduce the number of possible relations, a relation is direction
agnostic, i.e. the delta kind of Role.REF <> Role.ONE
is the
same as that of Role.ONE <> Role.REF
. When one of the roles is
Role.REF
, kinds like Delta.Kind.ADDED
and
Delta.Kind.DELETED
are always reported with that reference role
in mind. When a relation does not include a reference role e.g.
Role.ONE <> Role.TWO
, if there's a difference, it'll always be
reported as Delta.Kind.CHANGED
. In the case of addition or
deletion, the exact delta kind can be deduced by analyzing the deltas of
Role.ONE <> Role.REF
and Role.REF <> Role.TWO
.
relation
 Kind
of the specified relation
isOverallKind(Kind)