Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: ed63662fefe0b46a971e2cd2250cd05b5d769e22 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*******************************************************************************
 * Copyright (C) 2010, Dariusz Luksza <dariusz@luksza.org>
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
package org.eclipse.egit.ui.internal.synchronize;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Simple entity for remote and local repositories containing only repo name and
 * list of refs associated wit it.
 */
public class SyncRepoEntity {

	/**
	 * Simple entity for refs containing only human readable ref name and git
	 * ref path
	 */
	public static class SyncRefEntity {
		private final String descr;

		private final String value;

		/**
		 * @param descr
		 *            human readable description of repository
		 * @param value
		 *            value that will be associated with this repo eg. HEAD,
		 *            refs/heads/master, etc
		 */
		public SyncRefEntity(String descr, String value) {
			this.descr = descr;
			this.value = value;
		}

		/**
		 * @return human readable description of ref
		 */
		public String getDescription() {
			return descr;
		}

		/**
		 * @return value that is associated with this ref eg. HEAD,
		 *         refs/heads/master, etc.
		 */
		public String getValue() {
			return value;
		}
	}

	private final String name;

	private final List<SyncRefEntity> refs;

	/**
	 * @param name
	 *            of repository eg. local, origin, etc.
	 */
	public SyncRepoEntity(String name) {
		this.name = name;
		refs = new ArrayList<SyncRefEntity>();
	}

	/**
	 * @return name of repository
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param ref
	 *            that will be added to this repository
	 */
	public void addRef(SyncRefEntity ref) {
		refs.add(ref);
	}

	/**
	 *
	 * @return list of refs associated with this repository
	 */
	public List<SyncRefEntity> getRefList() {
		return Collections.unmodifiableList(refs);
	}

}

Back to the top