difflib
Class Chunk<T>

java.lang.Object
  extended by difflib.Chunk<T>

public class Chunk<T>
extends Object

Holds the information about the part of text involved in the diff process

Text is represented as Object[] because the diff engine is capable of handling more than plain ascci. In fact, arrays or lists of any type that implements hashCode() and equals() correctly can be subject to differencing using this library.

Author:
Constructor Summary
Chunk(int position, List<T> lines)
          Creates a chunk and saves a copy of affected lines
Chunk(int position, T[] lines)
          Creates a chunk and saves a copy of affected lines
 
Method Summary
 boolean equals(Object obj)
           
 List<T> getLines()
           
 int getPosition()
           
 int hashCode()
           
 int last()
          Returns the index of the last line of the chunk.
 void setLines(List<T> lines)
           
 int size()
           
 String toString()
           
 void verify(List<T> target)
          Verifies that this chunk's saved text matches the corresponding text in the given sequence.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Chunk

public Chunk(int position,
             List<T> lines)
Creates a chunk and saves a copy of affected lines

Parameters:
position - the start position
lines - the affected lines

Chunk

public Chunk(int position,
             T[] lines)
Creates a chunk and saves a copy of affected lines

Parameters:
position - the start position
lines - the affected lines
Method Detail

verify

public void verify(List<T> target)
            throws PatchFailedException
Verifies that this chunk's saved text matches the corresponding text in the given sequence.

Parameters:
target - the sequence to verify against.
Throws:
PatchFailedException

getPosition

public int getPosition()
Returns:
the start position of chunk in the text

setLines

public void setLines(List<T> lines)

getLines

public List<T> getLines()
Returns:
the affected lines

size

public int size()

last

public int last()
Returns the index of the last line of the chunk.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009-2013. All Rights Reserved.