Package com.day.util.diff
Class Document
- java.lang.Object
-
- com.day.util.diff.Document
-
public class Document extends java.lang.Object
A document represents a list of elements and have a source.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Document.AnnotatedElement
The annotated element include the document source.static interface
Document.Element
Elements form a document.
-
Constructor Summary
Constructors Constructor Description Document(DocumentSource source, ElementsFactory factory)
Create a new document with the given source and element factory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentDiff
diff(Document right)
Create a diff between this document and the given one.DocumentDiff3
diff3(Document left, Document right)
Create a tree-way-diff using this document as base.Document.Element[]
getElements()
Return the elements of this documentDocumentSource
getSource()
Return the source of this documentDocumentDiff
reverseDiff(Document left)
Create a diff between the given document and this one.
-
-
-
Constructor Detail
-
Document
public Document(DocumentSource source, ElementsFactory factory)
Create a new document with the given source and element factory- Parameters:
source
- the sourcefactory
- the element factory
-
-
Method Detail
-
getSource
public DocumentSource getSource()
Return the source of this document- Returns:
- the source.
-
getElements
public Document.Element[] getElements()
Return the elements of this document- Returns:
- the elements.
-
diff
public DocumentDiff diff(Document right)
Create a diff between this document and the given one.- Parameters:
right
- the other document to diff to.- Returns:
- a diff.
-
reverseDiff
public DocumentDiff reverseDiff(Document left)
Create a diff between the given document and this one.- Parameters:
left
- the other document.- Returns:
- a diff
-
diff3
public DocumentDiff3 diff3(Document left, Document right)
Create a tree-way-diff using this document as base.- Parameters:
left
- the left documentright
- the right document- Returns:
- a diff3
-
-