KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > taskdefs > cvslib > CVSEntry


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.taskdefs.cvslib;
19
20 import java.util.Date JavaDoc;
21 import java.util.Vector JavaDoc;
22
23 /**
24  * CVS Entry.
25  *
26  */

27 public class CVSEntry {
28     private Date JavaDoc date;
29     private String JavaDoc author;
30     private final String JavaDoc comment;
31     private final Vector JavaDoc files = new Vector JavaDoc();
32
33     /**
34      * Creates a new instance of a CVSEntry
35      * @param date the date
36      * @param author the author
37      * @param comment a comment to be added to the revision
38      */

39     public CVSEntry(final Date JavaDoc date, final String JavaDoc author, final String JavaDoc comment) {
40         this.date = date;
41         this.author = author;
42         this.comment = comment;
43     }
44
45     /**
46      * Adds a file to the CVSEntry
47      * @param file the file to add
48      * @param revision the revision
49      */

50     public void addFile(final String JavaDoc file, final String JavaDoc revision) {
51         files.addElement(new RCSFile(file, revision));
52     }
53
54     /**
55      * Adds a file to the CVSEntry
56      * @param file the file to add
57      * @param revision the revision
58      * @param previousRevision the previous revision
59      */

60     public void addFile(final String JavaDoc file, final String JavaDoc revision, final String JavaDoc previousRevision) {
61         files.addElement(new RCSFile(file, revision, previousRevision));
62     }
63
64     /**
65      * Gets the date of the CVSEntry
66      * @return the date
67      */

68     public Date JavaDoc getDate() {
69         return date;
70     }
71
72     /**
73      * Sets the author of the CVSEntry
74      * @param author the author
75      */

76     public void setAuthor(final String JavaDoc author) {
77         this.author = author;
78     }
79
80     /**
81      * Gets the author of the CVSEntry
82      * @return the author
83      */

84     public String JavaDoc getAuthor() {
85         return author;
86     }
87
88     /**
89      * Gets the comment for the CVSEntry
90      * @return the comment
91      */

92     public String JavaDoc getComment() {
93         return comment;
94     }
95
96     /**
97      * Gets the files in this CVSEntry
98      * @return the files
99      */

100     public Vector JavaDoc getFiles() {
101         return files;
102     }
103
104     /**
105      * Gets a String containing author, date, files and comment
106      * @return a string representation of this CVSEntry
107      */

108     public String JavaDoc toString() {
109         return getAuthor() + "\n" + getDate() + "\n" + getFiles() + "\n"
110             + getComment();
111     }
112 }
113
Popular Tags