Package com.github.difflib.patch
Class AbstractDelta<T>
- java.lang.Object
-
- com.github.difflib.patch.AbstractDelta<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ChangeDelta
,DeleteDelta
,EqualDelta
,InsertDelta
public abstract class AbstractDelta<T> extends java.lang.Object implements java.io.Serializable
Abstract delta between a source and a target.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
applyFuzzyToAt(java.util.List<T> target, int fuzz, int position)
Apply patch fuzzy.protected abstract void
applyTo(java.util.List<T> target)
boolean
equals(java.lang.Object obj)
Chunk<T>
getSource()
Chunk<T>
getTarget()
DeltaType
getType()
int
hashCode()
protected abstract void
restore(java.util.List<T> target)
protected VerifyChunk
verifyAntApplyTo(java.util.List<T> target)
protected VerifyChunk
verifyChunkToFitTarget(java.util.List<T> target)
Verify the chunk of this delta, to fit the target.abstract AbstractDelta<T>
withChunks(Chunk<T> original, Chunk<T> revised)
Create a new delta of the actual instance with customized chunk data.
-
-
-
Method Detail
-
getType
public DeltaType getType()
-
verifyChunkToFitTarget
protected VerifyChunk verifyChunkToFitTarget(java.util.List<T> target) throws PatchFailedException
Verify the chunk of this delta, to fit the target.- Parameters:
target
-- Throws:
PatchFailedException
-
verifyAntApplyTo
protected VerifyChunk verifyAntApplyTo(java.util.List<T> target) throws PatchFailedException
- Throws:
PatchFailedException
-
applyTo
protected abstract void applyTo(java.util.List<T> target) throws PatchFailedException
- Throws:
PatchFailedException
-
restore
protected abstract void restore(java.util.List<T> target)
-
applyFuzzyToAt
protected void applyFuzzyToAt(java.util.List<T> target, int fuzz, int position) throws PatchFailedException
Apply patch fuzzy.- Parameters:
target
- the list this patch will be applied tofuzz
- the number of elements to ignore before/after the patched elementsposition
- the position this patch will be applied to. ignoressource.getPosition()
- Throws:
PatchFailedException
- See Also:
- Description of Fuzzy Patch for more information.
-
withChunks
public abstract AbstractDelta<T> withChunks(Chunk<T> original, Chunk<T> revised)
Create a new delta of the actual instance with customized chunk data.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-