Mercurial > jhg
comparison src/org/tmatesoft/hg/core/Nodeid.java @ 170:71ddbf8603e8
Initial clone: populate given directory from a bundle. Everything but remote server access is there, albeit prototype code style
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 23 Mar 2011 20:46:00 +0100 |
parents | 1a7a9a20e1f9 |
children | 3a7696fb457c |
comparison
equal
deleted
inserted
replaced
169:8c8e3f372fa1 | 170:71ddbf8603e8 |
---|---|
28 * | 28 * |
29 * @author Artem Tikhomirov | 29 * @author Artem Tikhomirov |
30 * @author TMate Software Ltd. | 30 * @author TMate Software Ltd. |
31 * | 31 * |
32 */ | 32 */ |
33 public final class Nodeid { | 33 public final class Nodeid implements Comparable<Nodeid> { |
34 | 34 |
35 /** | 35 /** |
36 * <b>nullid</b>, empty root revision. | 36 * <b>nullid</b>, empty root revision. |
37 */ | 37 */ |
38 public static final Nodeid NULL = new Nodeid(new byte[20], false); | 38 public static final Nodeid NULL = new Nodeid(new byte[20], false); |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
71 public boolean equalsTo(byte[] buf) { | 71 public boolean equalsTo(byte[] buf) { |
72 return Arrays.equals(this.binaryData, buf); | 72 return Arrays.equals(this.binaryData, buf); |
73 } | |
74 | |
75 public int compareTo(Nodeid o) { | |
76 if (this == o) { | |
77 return 0; | |
78 } | |
79 for (int i = 0; i < 20; i++) { | |
80 if (binaryData[i] != o.binaryData[i]) { | |
81 return binaryData[i] < o.binaryData[i] ? -1 : 1; | |
82 } | |
83 } | |
84 return 0; | |
73 } | 85 } |
74 | 86 |
75 @Override | 87 @Override |
76 public String toString() { | 88 public String toString() { |
77 // XXX may want to output just single 0 for the NULL id? | 89 // XXX may want to output just single 0 for the NULL id? |