patch
Class Chunk

java.lang.Object
  extended by patch.Chunk

 class Chunk
extends java.lang.Object

This Library implements a simple patch algorithm which is able to process the output of diff in normal format. This class implements an immutable data structure that is used to store the modification chunks. A Chunk is a consecutive amount of changes. See the diff documentation for more information. see http://www.gnu.org/software/diffutils/manual/html_mono/diff.html#Normal

          Copyright (c) 2007 Dominik Schulz

          This file is part of jPatchLib.

          jPatchLib is free software; you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation; either version 2 of the License, or
          (at your option) any later version.

          jPatchLib is distributed in the hope that it will be useful,
          but WITHOUT ANY WARRANTY; without even the implied warranty of
          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
          GNU General Public License for more details.

          You should have received a copy of the GNU General Public License
          along with jPatchLib; if not, write to the Free Software
          Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 

Author:
Dominik

Field Summary
private  int from1
          Beginning of this change in the first file.
private  int from2
          End of this change in the first file.
private  char op
          What does this chunk do?
private  java.lang.String[] patch
          The old text.
private  java.lang.String[] target
          The new text.
private  int to1
          Beginning of this change in the second file.
private  int to2
          End of this change in the second file.
 
Constructor Summary
Chunk(char op, int from1, int from2, int to1, int to2, java.lang.String[] patch, java.lang.String[] target)
          Create a new chunk.
 
Method Summary
 int getFrom1()
           
 int getFrom2()
           
(package private)  java.lang.String getName()
           
 char getOp()
           
 java.lang.String[] getPatch()
           
 java.lang.String[] getTarget()
           
 int getTo1()
           
 int getTo2()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

op

private final char op
What does this chunk do? One of: a (add), c (change), or d (delete)


from1

private final int from1
Beginning of this change in the first file.


from2

private final int from2
End of this change in the first file.


to1

private final int to1
Beginning of this change in the second file.


to2

private final int to2
End of this change in the second file.


patch

private final java.lang.String[] patch
The old text.


target

private final java.lang.String[] target
The new text.

Constructor Detail

Chunk

public Chunk(char op,
             int from1,
             int from2,
             int to1,
             int to2,
             java.lang.String[] patch,
             java.lang.String[] target)
Create a new chunk.

Parameters:
op - a (add), d (delete) or c (change).
from1 -
from2 -
to1 -
to2 -
patch -
target -
Method Detail

getName

java.lang.String getName()

getFrom1

public int getFrom1()
Returns:
the from1

getFrom2

public int getFrom2()
Returns:
the from2

getOp

public char getOp()
Returns:
the op

getPatch

public java.lang.String[] getPatch()
Returns:
the patch

getTarget

public java.lang.String[] getTarget()
Returns:
the target

getTo1

public int getTo1()
Returns:
the to1

getTo2

public int getTo2()
Returns:
the to2