站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.5.0

Difference (NetBeans Diff API) - NetBeans API Javadoc 5.5.0

org.netbeans.modules.diff/1 1.15.22 42

org.netbeans.api.diff
Class Difference

java.lang.Object
  extended by org.netbeans.api.diff.Difference
All Implemented Interfaces:
Serializable

public class Difference
extends Object
implements Serializable

This class represents a single difference between two files.

See Also:
Serialized Form

Nested Class Summary
static class Difference.Part
          This class represents a difference on a single line.
 
Field Summary
static int ADD
          Add type of difference - a portion of a file was added in the other
static int CHANGE
          Change type of difference - a portion of a file was changed in the other
static int DELETE
          Delete type of difference - a portion of a file was removed in the other
 
Constructor Summary
Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd)
          Creates a new instance of Difference
Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd, String firstText, String secondText)
          Creates a new instance of Difference
Difference(int type, int firstStart, int firstEnd, int secondStart, int secondEnd, String firstText, String secondText, Difference.Part[] firstLineDiffs, Difference.Part[] secondLineDiffs)
          Creates a new instance of Difference
 
Method Summary
 int getFirstEnd()
          Get the line number on which the difference ends in the first file.
 Difference.Part[] getFirstLineDiffs()
          The list of differences on lines in the first file.
 int getFirstStart()
          Get the line number on which the difference starts in the first file.
 String getFirstText()
          Get the text content of the difference in the first file.
 int getSecondEnd()
          Get the line number on which the difference ends in the second file.
 Difference.Part[] getSecondLineDiffs()
          The list of differences on lines in the second file.
 int getSecondStart()
          Get the line number on which the difference starts in the second file.
 String getSecondText()
          Get the text content of the difference in the second file.
 int getType()
          Get the difference type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DELETE

public static final int DELETE
Delete type of difference - a portion of a file was removed in the other

See Also:
Constant Field Values

ADD

public static final int ADD
Add type of difference - a portion of a file was added in the other

See Also:
Constant Field Values

CHANGE

public static final int CHANGE
Change type of difference - a portion of a file was changed in the other

See Also:
Constant Field Values
Constructor Detail

Difference

public Difference(int type,
                  int firstStart,
                  int firstEnd,
                  int secondStart,
                  int secondEnd)
Creates a new instance of Difference

Parameters:
type - The type of the difference. Must be one of the DELETE, ADD or CHANGE
firstStart - The line number on which the difference starts in the first file.
firstEnd - The line number on which the difference ends in the first file.
secondStart - The line number on which the difference starts in the second file.
secondEnd - The line number on which the difference ends in the second file.

Difference

public Difference(int type,
                  int firstStart,
                  int firstEnd,
                  int secondStart,
                  int secondEnd,
                  String firstText,
                  String secondText)
Creates a new instance of Difference

Parameters:
type - The type of the difference. Must be one of the DELETE, ADD or CHANGE
firstStart - The line number on which the difference starts in the first file.
firstEnd - The line number on which the difference ends in the first file.
secondStart - The line number on which the difference starts in the second file.
secondEnd - The line number on which the difference ends in the second file.
firstText - The text content of the difference in the first file.
secondText - The text content of the difference in the second file.

Difference

public Difference(int type,
                  int firstStart,
                  int firstEnd,
                  int secondStart,
                  int secondEnd,
                  String firstText,
                  String secondText,
                  Difference.Part[] firstLineDiffs,
                  Difference.Part[] secondLineDiffs)
Creates a new instance of Difference

Parameters:
type - The type of the difference. Must be one of the DELETE, ADD or CHANGE
firstStart - The line number on which the difference starts in the first file.
firstEnd - The line number on which the difference ends in the first file.
secondStart - The line number on which the difference starts in the second file.
secondEnd - The line number on which the difference ends in the second file.
firstText - The text content of the difference in the first file.
secondText - The text content of the difference in the second file.
firstLineDiffs - The list of differences on lines in the first file. The list contains instances of Difference.Part. Can be null when there are no line differences.
secondLineDiffs - The list of differences on lines in the second file. The list contains instances of Difference.Part. Can be null when there are no line differences.
Method Detail

getType

public int getType()
Get the difference type. It's one of DELETE, ADD or CHANGE meaning respective change in second source.


getFirstStart

public int getFirstStart()
Get the line number on which the difference starts in the first file.

For ADD changes it returns previous line number e.g. 0 for add file start.


getFirstEnd

public int getFirstEnd()
Get the line number on which the difference ends in the first file.

Does not have any meaning for ADD changes.


getSecondStart

public int getSecondStart()
Get the line number on which the difference starts in the second file.


getSecondEnd

public int getSecondEnd()
Get the line number on which the difference ends in the second file.

Does not have any meaning for DELETE changes.


getFirstLineDiffs

public Difference.Part[] getFirstLineDiffs()
The list of differences on lines in the first file. The list contains instances of Difference.Part. Can be null when there are no line differences.


getSecondLineDiffs

public Difference.Part[] getSecondLineDiffs()
The list of differences on lines in the second file. The list contains instances of Difference.Part. Can be null when there are no line differences.


getFirstText

public String getFirstText()
Get the text content of the difference in the first file.


getSecondText

public String getSecondText()
Get the text content of the difference in the second file.


toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.diff/1 1.15.22 42

Built on May 28 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.