public class Granularity
extends java.lang.Object
Examples:
Shows to specify a granularity while comparing documents.
Document docA = new Document();
DocumentBuilder builderA = new DocumentBuilder(docA);
builderA.writeln("Alpha Lorem ipsum dolor sit amet, consectetur adipiscing elit");
Document docB = new Document();
DocumentBuilder builderB = new DocumentBuilder(docB);
builderB.writeln("Lorems ipsum dolor sit amet consectetur - \"adipiscing\" elit");
// Specify whether changes are tracking
// by character ('Granularity.CharLevel'), or by word ('Granularity.WordLevel').
CompareOptions compareOptions = new CompareOptions();
compareOptions.setGranularity(granularity);
docA.compare(docB, "author", new Date(), compareOptions);
// The first document's collection of revision groups contains all the differences between documents.
RevisionGroupCollection groups = docA.getRevisions().getGroups();
Assert.assertEquals(5, groups.getCount());
| Modifier and Type | Field and Description |
|---|---|
static int |
CHAR_LEVEL
Specifies changes at the character level.
|
static int |
length |
static int |
WORD_LEVEL
Specifies changes at the word level.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String granularityName) |
static java.lang.String |
getName(int granularity) |
static int[] |
getValues() |
static java.lang.String |
toString(int granularity) |