annotate src/org/tmatesoft/hg/util/Pair.java @ 373:dd492acd2431

Constants for well-known repository file names
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 06 Jan 2012 01:12:35 +0300
parents fd845a53f53d
children b015f3918120
rev   line source
235
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2011 TMate Software Ltd
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.util;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import org.tmatesoft.hg.internal.Experimental;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 /**
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 * Nothing but a holder for two values.
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 *
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 * @author Artem Tikhomirov
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25 * @author TMate Software Ltd.
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 */
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 @Experimental
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 public final class Pair<T1,T2> {
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 private final T1 value1;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 private final T2 value2;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 public Pair(T1 v1, T2 v2) {
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 value1 = v1;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 value2 = v2;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 }
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 public T1 first() {
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 return value1;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 }
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 public T2 second() {
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41 return value2;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 }
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 public boolean hasFirst() {
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44 return value1 != null;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 }
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 public boolean hasSecond() {
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 return value2 != null;
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 }
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 }
fd845a53f53d Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50