Package aQute.bnd.differ
Class DiffImpl
- java.lang.Object
-
- aQute.bnd.differ.DiffImpl
-
public class DiffImpl extends java.lang.Object implements Diff, java.lang.Comparable<DiffImpl>, java.util.Formattable
A DiffImpl class compares a newer Element to an older Element. The Element classes hide all the low level details. A Element class is either either Structured (has children) or it is a Leaf, it only has a value. The constructor will first build its children (if any) and then calculate the delta. Each comparable element is translated to an Element. If necessary the Element can be sub classed to provide special behavior.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface aQute.bnd.service.diff.Diff
Diff.Data, Diff.Ignore
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Collection<DiffImpl>children(package private) Deltadelta(package private) Treenewer(package private) Treeolder(package private) static Delta[][]TRANSITIONSThe transitions table defines how the state is escalated depending on the children.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(DiffImpl other)booleanequals(java.lang.Object other)private static voidformat(java.util.Formatter formatter, Diff diff, java.util.List<java.lang.String> formats, java.util.Set<Delta> deltas, int indent, int depth)voidformatTo(java.util.Formatter formatter, int flags, int width, int precision)Diffget(java.lang.String name)java.util.Collection<? extends Diff>getChildren()DeltagetDelta()Return the absolute delta.DeltagetDelta(Diff.Ignore ignore)This getDelta calculates the delta but allows the caller to ignore certain Diff objects by calling back the ignore call back parameter.java.lang.StringgetName()TreegetNewer()TreegetOlder()TypegetType()inthashCode()Diff.Dataserialize()java.lang.StringtoString()
-
-
-
Field Detail
-
older
final Tree older
-
newer
final Tree newer
-
children
final java.util.Collection<DiffImpl> children
-
delta
final Delta delta
-
TRANSITIONS
static final Delta[][] TRANSITIONS
The transitions table defines how the state is escalated depending on the children. horizontally is the current delta and this is indexed with the child delta for each child. This escalates deltas from below up.
-
-
Method Detail
-
getDelta
public Delta getDelta()
Return the absolute delta. Also seegetDelta(aQute.bnd.service.diff.Diff.Ignore)that allows you to ignore Diff objects on the fly (and calculate their parents accordingly).
-
getDelta
public Delta getDelta(Diff.Ignore ignore)
This getDelta calculates the delta but allows the caller to ignore certain Diff objects by calling back the ignore call back parameter. This can be useful to ignore warnings/errors.
-
getChildren
public java.util.Collection<? extends Diff> getChildren()
- Specified by:
getChildrenin interfaceDiff
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(DiffImpl other)
- Specified by:
compareToin interfacejava.lang.Comparable<DiffImpl>
-
formatTo
public void formatTo(java.util.Formatter formatter, int flags, int width, int precision)- Specified by:
formatToin interfacejava.util.Formattable
-
-