org.tmatesoft.svn.core
Class SVNMergeRange

java.lang.Object
  extended by 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

Constructor Summary
SVNMergeRange(long startRevision, long endRevision, boolean isInheritable)
          Constructs a new SVNMergeRange object.
 
Method Summary
 boolean canCombine(SVNMergeRange range, boolean considerInheritance)
          Tells whether this range can me combined with the given range depending on inheritance or not.
 SVNMergeRange combine(SVNMergeRange range, boolean considerInheritance)
          Combines this merge range and the given range 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 specified range 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 to obj 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 specified range 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SVNMergeRange

public SVNMergeRange(long startRevision,
                     long endRevision,
                     boolean isInheritable)
Constructs a new SVNMergeRange object.

Parameters:
startRevision - start revision of this merge range
endRevision - end revision of this merge range
isInheritable - 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 by SVNKit 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 by SVNKit 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 range inheritance is not taken into account when comparing two SVNMergeRange objects.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - object to compare to
Returns:
0 if o is exactly this object or o.getStartRevision() == this.getStartRevision() && o.getEndRevision() == this.getEndRevision(); -1 if either this.getStartRevision() < o.getStartRevision() or this.getStartRevision() == o.getStartRevision() && this.getEndRevision() < o.getEndRevision(); 1 if either this.getStartRevision() > o.getStartRevision() or this.getStartRevision() == o.getStartRevision() && this.getEndRevision() > o.getEndRevision()

equals

public boolean equals(java.lang.Object obj)
Says if this object is equal to obj or not.

Identical to this.compareTo(obj) == 0.

Overrides:
equals in class java.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 given range into a single one.

Combining may only occur if canCombine(SVNMergeRange, boolean) returns true for the specified parameters.

Note: combining changes the state of this object.

Parameters:
range - range to combine with this range
considerInheritance - 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 given range 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 range
considerInheritance - 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 specified range depending on inheritance or not.

Parameters:
range - range to check
considerInheritance - 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 specified range depending on inheritance or not.

Parameters:
range - range to check
considerInheritance - 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 by SVNKit 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 class java.lang.Object
Returns:
this object as a string