Skip to content

sebasjm/deepdiff

Repository files navigation

DeepDiff

Another deep diff algorithm but this time using Kotlin Lang

Getting Started

TBD

Prerequisites

TBD

> git clone https://github.com/sebasjm/deepdiff
> cd deepdiff
> ./gradlew build

Installing

In your project

    compile "ar.com.sebasjm:deepdiff:0.1-SNAPSHOT"

Using it

Instanciate a stateless diff

    val diff = Diff()

list differences with it

    val result : List<Patch<Any>> = diff.list(from, to)

Patch has a coordinate and a delta.

class Patch(val coordinate : Coordinate, val delta : Delta)

Coordinate has a string represtantation and point to the property to be patch or modified. Ej:

Alt text

custom_mark_coordinate interface Coordinate {} /** @opt attributes */ class RootCoordinate implements Coordinate { public String name; } /** @opt attributes */ abstract class RelativeCoordinate implements Coordinate { public Coordinate parent; public String relativeName; } class ArrayCoordinate extends RelativeCoordinate {} class ClassCoordinate extends RelativeCoordinate {} class FieldCoordinate extends RelativeCoordinate {} class ListCoordinate extends RelativeCoordinate {} class MapCoordinate extends RelativeCoordinate {} class SetCoordinate extends RelativeCoordinate {} class SizeCoordinate extends RelativeCoordinate {}

custom_mark_coordinate

Delta is the action, has 3 subtypes: DeltaAdd, DeltaMod and DeltaDel

Alt text

custom_mark_delta interface Delta{} /** * @opt all */ class DeltaMod implements Delta{ public final Type before; public final Type after; } /** * @opt all */ class DeltaAdd implements Delta{ public final Type after; } /** * @opt all */ class DeltaDel implements Delta{ public final Type before; }

custom_mark_delta

Running the tests

./gradlw test

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

License

This project is licensed under the Apache2 License - see the LICENSE.md file for details

Acknowledgments

About

Another deep diff implementation for java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages