Package org.tmatesoft.svn.core
Class SVNMergeRange
- java.lang.Object
-
- org.tmatesoft.svn.core.SVNMergeRange
-
- All Implemented Interfaces:
java.lang.Comparable
public class SVNMergeRange extends java.lang.Object implements java.lang.Comparable
The SVNMergeRange class represents a range of merged revisions.- Since:
- 1.2
- Version:
- 1.3
-
-
Field Summary
Fields Modifier and Type Field Description private long
myEndRevision
private boolean
myIsInheritable
private long
myStartRevision
-
Constructor Summary
Constructors Constructor Description SVNMergeRange(long startRevision, long endRevision, boolean isInheritable)
Constructs a newSVNMergeRange
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCombine(SVNMergeRange range, boolean considerInheritance)
Tells whether this range can me combined with the givenrange
depending on inheritance or not.SVNMergeRange
combine(SVNMergeRange range, boolean considerInheritance)
Combines this merge range and the givenrange
into a single one.int
compareTo(java.lang.Object o)
Compares this object to another one.boolean
contains(SVNMergeRange range, boolean considerInheritance)
Says whether this range contains the specifiedrange
depending on inheritance or not.SVNMergeRange
dup()
Makes an exact copy of this object.boolean
equals(java.lang.Object obj)
Says if this object is equal toobj
or not.long
getEndRevision()
Returns the end revision of this merge range.long
getStartRevision()
Returns the start revision of this merge range.boolean
intersects(SVNMergeRange range, boolean considerInheritance)
Says whether this range intersects the specifiedrange
depending on inheritance or not.boolean
isInheritable()
Tells whether this merge range should be inherited by treewise descendants of the path to which the range applies.void
setEndRevision(long endRevision)
Sets the end revision of this merge range.void
setInheritable(boolean isInheritable)
Sets whether this merge range is inheritable or not.void
setStartRevision(long startRevision)
Sets the start revision of this merge range.SVNMergeRange
swapEndPoints()
Swaps the start revision and the end revision of this merge range object.java.lang.String
toString()
Return a string representation of this object.
-
-
-
Constructor Detail
-
SVNMergeRange
public SVNMergeRange(long startRevision, long endRevision, boolean isInheritable)
Constructs a newSVNMergeRange
object.- Parameters:
startRevision
- start revision of this merge rangeendRevision
- end revision of this merge rangeisInheritable
- whether this range is inheritable or not
-
-
Method Detail
-
getEndRevision
public long getEndRevision()
Returns the end revision of this merge range.- Returns:
- end revision
-
getStartRevision
public long getStartRevision()
Returns the start revision of this merge range.- Returns:
- start revision
-
setEndRevision
public void setEndRevision(long endRevision)
Sets the end revision of this merge range. This method is used bySVNKit
internals and is not intended for API users.- Parameters:
endRevision
- merge range end revision
-
setStartRevision
public void setStartRevision(long startRevision)
Sets the start revision of this merge range. This method is used bySVNKit
internals and is not intended for API users.- Parameters:
startRevision
- merge range start revision
-
compareTo
public int compareTo(java.lang.Object o)
Compares this object to another one. Note: merge rangeinheritance
is not taken into account when comparing twoSVNMergeRange
objects.- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
o
- object to compare to- Returns:
0
ifo
is exactly this object oro.getStartRevision() == this.getStartRevision() && o.getEndRevision() == this.getEndRevision()
;-1
if eitherthis.getStartRevision() < o.getStartRevision()
orthis.getStartRevision() == o.getStartRevision() && this.getEndRevision() < o.getEndRevision()
;1
if eitherthis.getStartRevision() > o.getStartRevision()
orthis.getStartRevision() == o.getStartRevision() && this.getEndRevision() > o.getEndRevision()
-
equals
public boolean equals(java.lang.Object obj)
Says if this object is equal toobj
or not. Identical tothis.compareTo(obj) == 0
.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- object ot compare to- Returns:
- true if equal; otherwise false
-
combine
public SVNMergeRange combine(SVNMergeRange range, boolean considerInheritance)
Combines this merge range and the givenrange
into a single one. Combining may only occur ifcanCombine(SVNMergeRange, boolean)
returns true for the specified parameters. Note: combining changes the state of this object.- Parameters:
range
- range to combine with this rangeconsiderInheritance
- whether inheritance information should be taken into account- Returns:
- if combining occurs, returns this object which is now a combination
of the two ranges; otherwise returns
range
-
canCombine
public boolean canCombine(SVNMergeRange range, boolean considerInheritance)
Tells whether this range can me combined with the givenrange
depending on inheritance or not. Combining may occur only when two ranges intersect each other what may be checked by the following case:range1.getStartRevision() <= range2.getEndRevision() && range2.getStartRevision() <= range1.getEndRevision()
. If this condition evaluates to true, then the ranges intersect.- Parameters:
range
- range to combine with this rangeconsiderInheritance
- whether inheritance information should be taken into account or not- Returns:
- true when the ranges intersect,
considerInheritance
is not set, or if set, both ranges have the same inheritance; otherwise false
-
contains
public boolean contains(SVNMergeRange range, boolean considerInheritance)
Says whether this range contains the specifiedrange
depending on inheritance or not.- Parameters:
range
- range to checkconsiderInheritance
- whether inheritance information should be taken into account or not- Returns:
- true if this range contains the
specified
range
; otherwise false
-
intersects
public boolean intersects(SVNMergeRange range, boolean considerInheritance)
Says whether this range intersects the specifiedrange
depending on inheritance or not.- Parameters:
range
- range to checkconsiderInheritance
- whether inheritance information should be taken into account or not- Returns:
- true if this range intersects the
specified
range
; otherwise false
-
swapEndPoints
public SVNMergeRange swapEndPoints()
Swaps the start revision and the end revision of this merge range object.- Returns:
- this object itself
-
isInheritable
public boolean isInheritable()
Tells whether this merge range should be inherited by treewise descendants of the path to which the range applies.- Returns:
- true if inheritable; otherwise false
-
setInheritable
public void setInheritable(boolean isInheritable)
Sets whether this merge range is inheritable or not. This method is used bySVNKit
internals and is not intended for API users.- Parameters:
isInheritable
- whether this range is inheritable or not
-
dup
public SVNMergeRange dup()
Makes an exact copy of this object.- Returns:
- exact copy of this object
-
toString
public java.lang.String toString()
Return a string representation of this object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- this object as a string
-
-