Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 14b73bbdb2e48c88045c1593fffe447ae51a95ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package org.eclipse.team.internal.ccvs.core.resources;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */

import org.eclipse.team.ccvs.core.CVSTag;

public class CVSEntryLineTag extends CVSTag {
	
	/*
	 * The parameter tag must not be null.
	 */
	public CVSEntryLineTag(CVSTag tag) {
		super(tag.getName(), tag.getType());
	}
	
	public CVSEntryLineTag(String entryLineTag) {
		switch (entryLineTag.charAt(0)) {
			case 'T' : type = BRANCH; break;
			case 'N' : type = VERSION; break;
			case 'D' : type = DATE; break;
			default: type = HEAD;
		}
		name = entryLineTag.substring(1);
	}
	/*
	 * Returns the tag name
	 */
	public String getName() {
		return name;
	}
	/*
	 * Returns the tag type
	 */
	public int getType() {
		return type;
	}
	
	public String toEntryLineFormat() {
		if (type == BRANCH)
			return "T" + name;
		else if (type == VERSION)
			return "N" + name;
		else if (type == DATE)
			return "D" + name;
		return "";
	}
	
	public boolean equals(Object obj) {
		// We assume, that the name and type can not be null
		if (obj == this) return true;
		if (!(obj instanceof CVSEntryLineTag)) return false;
		return (type == ((CVSEntryLineTag)obj).type) && name.equals(((CVSEntryLineTag)obj).name);
	}
}

Back to the top