KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > jrcs > diff > print > BasePrint


1 /*
2  * ====================================================================
3  *
4  * The Apache Software License, Version 1.1
5  *
6  * Copyright (c) 1999-2003 The Apache Software Foundation.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution, if
22  * any, must include the following acknowledgement:
23  * "This product includes software developed by the
24  * Apache Software Foundation (http://www.apache.org/)."
25  * Alternately, this acknowledgement may appear in the software itself,
26  * if and wherever such third-party acknowledgements normally appear.
27  *
28  * 4. The names "The Jakarta Project", "Commons", and "Apache Software
29  * Foundation" must not be used to endorse or promote products derived
30  * from this software without prior written permission. For written
31  * permission, please contact apache@apache.org.
32  *
33  * 5. Products derived from this software may not be called "Apache"
34  * nor may "Apache" appear in their names without prior written
35  * permission of the Apache Software Foundation.
36  *
37  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48  * SUCH DAMAGE.
49  * ====================================================================
50  *
51  * This software consists of voluntary contributions made by many
52  * individuals on behalf of the Apache Software Foundation. For more
53  * information on the Apache Software Foundation, please see
54  * <http://www.apache.org/>.
55  *
56  */

57
58 package org.apache.commons.jrcs.diff.print;
59
60 import java.util.Date JavaDoc;
61
62 import org.apache.commons.jrcs.diff.AddDelta;
63 import org.apache.commons.jrcs.diff.ChangeDelta;
64 import org.apache.commons.jrcs.diff.DeleteDelta;
65 import org.apache.commons.jrcs.diff.Diff;
66 import org.apache.commons.jrcs.diff.Revision;
67 import org.apache.commons.jrcs.diff.RevisionVisitor;
68
69 /**
70  * Base class for printing revisions in various formats.
71  *
72  * @author <a HREF="mailto:ludovicc@users.sourceforge.net">Ludovic Claude</a>
73  * @version $Revision: 1.2 $ $Date: 2005/06/16 18:11:11 $
74  * @created on 17 janv. 2004
75  */

76 public class BasePrint implements RevisionVisitor {
77
78     private StringBuffer JavaDoc sb;
79     private String JavaDoc command;
80     private String JavaDoc fileName;
81     private String JavaDoc rcsFileName;
82     private String JavaDoc originalVersion;
83     private String JavaDoc revisedVersion;
84     private Date JavaDoc originalModifDate;
85     private Date JavaDoc revisedModifDate;
86     private String JavaDoc EOL = Diff.RCS_EOL;
87
88     /**
89      * Constructor for BasePrint
90      *
91      */

92     public BasePrint(StringBuffer JavaDoc sb) {
93         super();
94         this.sb = sb;
95     }
96
97     /**
98      * Gets the command.
99      * @return the command.
100      */

101     public String JavaDoc getCommand() {
102         return command;
103     }
104
105     /**
106      * Sets the command.
107      * @param command The command to set.
108      */

109     public void setCommand(String JavaDoc command) {
110         this.command = command;
111     }
112
113     /**
114      * Gets the fileName.
115      * @return the fileName.
116      */

117     public String JavaDoc getFileName() {
118         return fileName;
119     }
120
121     /**
122      * Sets the fileName.
123      * @param fileName The fileName to set.
124      */

125     public void setFileName(String JavaDoc fileName) {
126         this.fileName = fileName;
127     }
128
129     /**
130      * Gets the rcsFileName.
131      * @return the rcsFileName.
132      */

133     public String JavaDoc getRCSFileName() {
134         return rcsFileName;
135     }
136
137     /**
138      * Sets the rcsFileName.
139      * @param rcsFileName The rcsFileName to set.
140      */

141     public void setRCSFileName(String JavaDoc rcsFileName) {
142         this.rcsFileName = rcsFileName;
143     }
144
145     /**
146      * Gets the originalVersion.
147      * @return the originalVersion.
148      */

149     public String JavaDoc getOriginalVersion() {
150         return originalVersion;
151     }
152
153     /**
154      * Sets the originalVersion.
155      * @param originalVersion The originalVersion to set.
156      */

157     public void setOriginalVersion(String JavaDoc originalVersion) {
158         this.originalVersion = originalVersion;
159     }
160
161     /**
162      * Gets the revisedVersion.
163      * @return the revisedVersion.
164      */

165     public String JavaDoc getRevisedVersion() {
166         return revisedVersion;
167     }
168
169     /**
170      * Sets the revisedVersion.
171      * @param revisedVersion The revisedVersion to set.
172      */

173     public void setRevisedVersion(String JavaDoc revisedVersion) {
174         this.revisedVersion = revisedVersion;
175     }
176
177     /**
178      * Gets the originalModifDate.
179      * @return the originalModifDate.
180      */

181     public Date JavaDoc getOriginalModifDate() {
182         return originalModifDate;
183     }
184
185     /**
186      * Sets the originalModifDate.
187      * @param originalModifDate The originalModifDate to set.
188      */

189     public void setOriginalModifDate(Date JavaDoc originalModifDate) {
190         this.originalModifDate = originalModifDate;
191     }
192
193     /**
194      * Gets the revisedModifDate.
195      * @return the revisedModifDate.
196      */

197     public Date JavaDoc getRevisedModifDate() {
198         return revisedModifDate;
199     }
200
201     /**
202      * Sets the revisedModifDate.
203      * @param revisedModifDate The revisedModifDate to set.
204      */

205     public void setRevisedModifDate(Date JavaDoc revisedModifDate) {
206         this.revisedModifDate = revisedModifDate;
207     }
208
209     /**
210      * Gets the EOL.
211      * @return the EOL.
212      */

213     public String JavaDoc getEOL() {
214         return EOL;
215     }
216
217     /**
218      * Sets the EOL.
219      * @param eol The EOL to set.
220      */

221     public void setEOL(String JavaDoc eol) {
222         EOL = eol;
223     }
224
225     /**
226      * {@inheritDoc}
227      * @param revision
228      */

229     public void visit(Revision revision) {
230         printHeader();
231     }
232
233     /**
234      * {@inheritDoc}
235      * @param delta
236      */

237     public void visit(DeleteDelta delta) {
238         // do nothing
239
}
240
241     /**
242      * {@inheritDoc}
243      * @param delta
244      */

245     public void visit(ChangeDelta delta) {
246         // do nothing
247
}
248
249     /**
250      * {@inheritDoc}
251      * @param delta
252      */

253     public void visit(AddDelta delta) {
254         // do nothing
255
}
256
257     protected void printHeader() {
258         // do nothing
259
}
260
261     protected StringBuffer JavaDoc getStringBuffer() {
262         return sb;
263     }
264
265 }
266
Popular Tags