30
30
public class RevisionRange implements Comparable<RevisionRange>, java.io.Serializable
32
// Update the serialVersionUID when there is a incompatible change
33
// made to this class. See any of the following, depending upon
35
// http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html
36
// http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
37
// http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
38
// http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678
39
private static final long serialVersionUID = 1L;
32
// Update the serialVersionUID when there is a incompatible change made to
33
// this class. See the java documentation for when a change is incompatible.
34
// http://java.sun.com/javase/7/docs/platform/serialization/spec/version.html#6678
35
private static final long serialVersionUID = 2L;
41
37
private Revision from;
42
38
private Revision to;
39
private boolean inheritable;
45
42
* Creates a new instance. Called by native library.
47
@SuppressWarnings("unused")
48
private RevisionRange(long from, long to)
44
protected RevisionRange(long from, long to, boolean inheritable)
50
46
this.from = Revision.getInstance(from);
51
47
this.to = Revision.getInstance(to);
48
this.inheritable = inheritable;
52
public RevisionRange(Revision from, Revision to, boolean inheritable)
56
this.inheritable = inheritable;
54
59
public RevisionRange(Revision from, Revision to)
63
this.inheritable = true;
95
106
long revNum = Long.parseLong(revisionElement.trim());
96
this.from = new Revision.Number(revNum);
109
this.to = new Revision.Number(revNum);
110
this.from = new Revision.Number(revNum - 1);
99
112
catch (NumberFormatException e)
129
public boolean isInheritable()
116
134
public String toString()
118
136
if (from != null && to != null)
121
return from.toString();
140
if (from.getKind() == Revision.Kind.number
141
&& to.getKind() == Revision.Kind.number
142
&& (((Revision.Number)from).getNumber() + 1
143
== ((Revision.Number)to).getNumber()))
145
else if (from.equals(to)) // Such ranges should never happen
146
rep = from.toString();
123
return from.toString() + '-' + to.toString();
148
rep = from.toString() + '-' + to.toString();
125
153
return super.toString();