01: /*
02: * Copyright (C) 2001, 2002 Robert MacGrogan
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: *
19: * $Archive: SourceJammer$
20: * $FileName: Hunk.java$
21: * $FileID: 4300$
22: *
23: * Last change:
24: * $AuthorName: Rob MacGrogan$
25: * $Date: 4/23/03 5:23 PM$
26: * $Comment: Replaced GPL header with LGPL header.$
27: *
28: * $KeyWordsOff: $
29: */
30:
31: package JLibDiff;
32:
33: import java.util.*;
34:
35: /**
36: * The <code>Hunk</code> class is a super class of classes <code>HunkAdd ,
37: * HunkChange</code> and <code>HunkDel</code> .it is an abstarct class.
38: */
39: public abstract class Hunk implements HunkVisitable {
40:
41: Hunk next = null;
42:
43: public abstract void accept(HunkVisitor visitor);
44:
45: /**
46: * Returns a string representation of the current hunk
47: * with normal format .
48: */
49: public abstract String convert();
50:
51: /**
52: * Returns a string representation of the current hunk
53: * with ED_script format .
54: */
55: public abstract String convert_ED();
56:
57: /**
58: * Returns a string representation of the current hunk
59: * with RCS_script format .
60: */
61: public abstract String convert_RCS();
62:
63: /**
64: * Returns the number of low line of file passed in argument .
65: * Lines are inclusif.
66: *
67: * @param filenum The number of file (the first file '0', or the second '1').
68: */
69: public abstract int lowLine(int filenum);
70:
71: /**
72: * Returns the number of high line of file passed in argument .
73: * Lines are inclusif.
74: *
75: * @param filenum The number of file (the first file '0', or the second '1').
76: */
77: public abstract int highLine(int filenum);
78:
79: /**
80: * Returns the number of lines consedered in this hunk and which
81: * came from file passed in argument .
82: *
83: * @param filenum The number of file (the first file '0', or the second '1').
84: */
85: public abstract int numLines(int filenum);
86:
87: /**
88: * Returns a string representing the line in file and position
89: * passed in argument.
90: *
91: * @param filenum The number of file (the first file '0', or the second '1').
92: * @param linenum the number of line that will be returned.
93: */
94: public abstract String relNum(int filenum, int linenum);
95:
96: }
|