Mercurial > jhg
annotate src/org/tmatesoft/hg/util/Pair.java @ 570:36853bb80a35
Tests for HgAnnotateCommand with follow/no-follow option
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 11 Apr 2013 16:07:17 +0200 |
parents | 5311e041d2dd |
children |
rev | line source |
---|---|
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
235
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 |
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 * Nothing but a holder for two values. |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 * |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 * @author Artem Tikhomirov |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 * @author TMate Software Ltd. |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 */ |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 public final class Pair<T1,T2> { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 private final T1 value1; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 private final T2 value2; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 public Pair(T1 v1, T2 v2) { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 value1 = v1; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 value2 = v2; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 public T1 first() { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 return value1; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 public T2 second() { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 return value2; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 public boolean hasFirst() { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 return value1 != null; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 public boolean hasSecond() { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 return value2 != null; |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 } |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
47 |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
48 @Override |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
49 public String toString() { |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
50 StringBuilder sb = new StringBuilder(); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
51 sb.append('<'); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
52 sb.append(first()); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
53 sb.append(':'); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
54 sb.append(second()); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
55 sb.append('>'); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
56 return sb.toString(); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
57 } |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 |