Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62af909

Browse files
authored
Update README.md
1 parent ace12a6 commit 62af909

File tree

1 file changed

+95
-1
lines changed

1 file changed

+95
-1
lines changed

README.md

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,96 @@
11
# java-diff-utils
2-
Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.
2+
3+
## Status
4+
5+
[![Build Status](https://travis-ci.org/java-diff-utils/java-diff-utils.svg?branch=master)](https://travis-ci.org/java-diff-utils/java-diff-utils)
6+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7eba77f10bed4c2a8d08ac8dc8da4a86)](https://www.codacy.com/app/wumpz/java-diff-utils?utm_source=github.com&utm_medium=referral&utm_content=java-diff-utils/java-diff-utils&utm_campaign=Badge_Grade)
7+
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.java-diff-utils/java-diff-utils/badge.svg)](http://maven-badges.herokuapp.com/maven-central/io.github.java-diff-utils/java-diff-utils)
8+
9+
## Intro
10+
11+
Diff Utils library is an OpenSource library for performing the comparison operations between texts: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.
12+
13+
Main reason to build this library was the lack of easy-to-use libraries with all the usual stuff you need while working with diff files. Originally it was inspired by JRCS library and it's nice design of diff module.
14+
15+
**This is originally a fork of java-diff-utils from Google Code Archive.**
16+
17+
## API
18+
19+
Javadocs of the actual release version: [JavaDocs java-diff-utils](https://java-diff-utils.github.io/java-diff-utils/4.7/docs/api/)
20+
21+
## Examples
22+
23+
Look [here](https://github.com/wumpz/java-diff-utils/wiki) to find more helpful informations and examples.
24+
25+
These two outputs are generated using this java-diff-utils. The source code can also be found at the *Examples* page:
26+
27+
**Producing a one liner including all difference information.**
28+
29+
This is a test ~senctence~**for diffutils**.
30+
31+
**Producing a side by side view of computed differences.**
32+
33+
|original|new|
34+
|--------|---|
35+
|This is a test ~senctence~.|This is a test **for diffutils**.|
36+
|This is the second line.|This is the second line.|
37+
|~And here is the finish.~||
38+
39+
## Main Features
40+
41+
* computing the difference between two texts.
42+
* capable to hand more than plain ascii. Arrays or List of any type that implements hashCode() and equals() correctly can be subject to differencing using this library
43+
* patch and unpatch the text with the given patch
44+
* parsing the unified diff format
45+
* producing human-readable differences
46+
* inline difference construction
47+
* Algorithms:
48+
* Myer
49+
* HistogramDiff using JGit Library
50+
51+
### Algorithms
52+
53+
* Myer's diff
54+
* HistogramDiff
55+
56+
But it can easily replaced by any other which is better for handing your texts. I have plan to add implementation of some in future.
57+
58+
## Source Code conventions
59+
60+
Recently a checkstyle process was integrated into the build process. java-diff-utils follows the sun java format convention. There are no TABs allowed. Use spaces.
61+
62+
```java
63+
public static <T> Patch<T> diff(List<T> original, List<T> revised,
64+
BiPredicate<T, T> equalizer) throws DiffException {
65+
if (equalizer != null) {
66+
return DiffUtils.diff(original, revised,
67+
new MyersDiff<>(equalizer));
68+
}
69+
return DiffUtils.diff(original, revised, new MyersDiff<>());
70+
}
71+
```
72+
73+
This is a valid piece of source code:
74+
75+
* blocks without braces are not allowed
76+
* after control statements (if, while, for) a whitespace is expected
77+
* the opening brace should be in the same line as the control statement
78+
79+
### To Install
80+
81+
Just add the code below to your maven dependencies:
82+
83+
```xml
84+
<dependency>
85+
<groupId>io.github.java-diff-utils</groupId>
86+
<artifactId>java-diff-utils</artifactId>
87+
<version>4.5</version>
88+
</dependency>
89+
```
90+
91+
or using gradle:
92+
93+
```groovy
94+
// https://mvnrepository.com/artifact/io.github.java-diff-utils/java-diff-utils
95+
implementation "io.github.java-diff-utils:java-diff-utils:4.5"
96+
```

0 commit comments

Comments
 (0)