Class DiffImpl

  • All Implemented Interfaces:
    Diff, java.lang.Comparable<DiffImpl>, java.util.Formattable

    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.
    • Constructor Detail

      • DiffImpl

        public DiffImpl​(Tree newer,
                        Tree older)
        Compares the newer against the older, traversing the children if necessary.
        Parameters:
        newer - The newer Element
        older - The older Element
    • Method Detail

      • 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.
        Specified by:
        getDelta in interface Diff
      • getType

        public Type getType()
        Specified by:
        getType in interface Diff
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface Diff
      • getChildren

        public java.util.Collection<Diff> getChildren()
        Specified by:
        getChildren in interface Diff
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(DiffImpl other)
        Specified by:
        compareTo in interface java.lang.Comparable<DiffImpl>
      • get

        public Diff get​(java.lang.String name)
        Specified by:
        get in interface Diff
      • formatTo

        public void formatTo​(java.util.Formatter formatter,
                             int flags,
                             int width,
                             int precision)
        Specified by:
        formatTo in interface java.util.Formattable