VTT Java
2010 Version

gov.nih.nlm.nls.vtt.Lib
Class Difference

java.lang.Object
  extended by gov.nih.nlm.nls.vtt.Lib.Difference

public class Difference
extends java.lang.Object

This class is modified from Difference.java from incava.org. It represents a difference, as used in Diff.java. A difference consists of two pairs of starting and ending points, each pair representing either the "from" or the "to" collection passed to Diff class. If an ending point is -1, then the difference was either a deletion or an addition. For example, if GetDeletedEnd() returns -1, then the difference represents an addition; if GetAddEnd() returns -1, then the difference represents an deletion.

History:

Version:
V-2010
Author:
NLM NLS Development Team, clu

Field Summary
static int NONE
          definition for none
 
Constructor Summary
Difference(int delStart, int delEnd, int addStart, int addEnd)
          public constructor of Difference by specifying deletion start and end, addition start and end.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this object to the other for equality.
 int GetAddedEnd()
          Get the addition end
 int GetAddedStart()
          Get the addition start
 int GetDeletedEnd()
          Get the deletion end
 int GetDeletedStart()
          Get the deletion start
 void SetAdded(int line)
          Set the Added line.
 void SetDeleted(int line)
          Set the deletion line.
 java.lang.String toString()
          Returns a string representation of this Difference.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
definition for none

See Also:
Constant Field Values
Constructor Detail

Difference

public Difference(int delStart,
                  int delEnd,
                  int addStart,
                  int addEnd)
public constructor of Difference by specifying deletion start and end, addition start and end.

Method Detail

GetDeletedStart

public int GetDeletedStart()
Get the deletion start

Returns:
the deletion start line number

GetDeletedEnd

public int GetDeletedEnd()
Get the deletion end

Returns:
the deletion end line number

GetAddedStart

public int GetAddedStart()
Get the addition start

Returns:
the addition start line number

GetAddedEnd

public int GetAddedEnd()
Get the addition end

Returns:
the addition end line number

SetDeleted

public void SetDeleted(int line)
Set the deletion line. Use this line number as deletion start if it is less than start, use this line number as deletion end if it is greater than end.

Parameters:
line - the deletion line number

SetAdded

public void SetAdded(int line)
Set the Added line. Use this line number as addition start if it is less than start, use this line number as addition end if it is greater than end.

Parameters:
line - the deletion line number

equals

public boolean equals(java.lang.Object obj)
Compares this object to the other for equality. Both objects must be of type Difference, with the same starting and ending points.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Difference object to compare to
Returns:
a boolean flag, true if it is equal, false if not

toString

public java.lang.String toString()
Returns a string representation of this Difference.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Difference object

VTT Java
2010 Version

Submit a bug or feature

Copyright © 2010 National Library of Medicine