C# Class PutioFS.Core.LongRange

A class to represent a range of long values. Start is inclusive, End is exclusive.
Inheritance: IComparable
Datei anzeigen Open project: firat/PutioFS Class Usage Examples

Public Methods

Method Description
CompareTo ( object obj ) : int

First compare the Start values, if they are equal, compare End values.

Contains ( long value ) : System.Boolean

Check if the range contains the given value.

Intersects ( LongRange range ) : System.Boolean

Check if this object intersects with the given range. Start positions are inclusive and End positions are exclusive.

IsConsequent ( LongRange range ) : System.Boolean

Check if this objects comes RIGHT AFTER or RIGHT BEFORE the given range. That is. this.Start is equal to range.End or vice versa.

LongRange ( long start, long end ) : System

Never ever let a LongRange with an end value that is smaller than or equal to its start value

Merge ( LongRange range ) : void

Merge this LongRange with a one that intersects it.

TryMerge ( LongRange range ) : System.Boolean

Try to merge two Ranges. Do nothing if they are not consecutive or intersecting ranges. Return true if merged, false otherwise.

Method Details

CompareTo() public method

First compare the Start values, if they are equal, compare End values.
public CompareTo ( object obj ) : int
obj object
return int

Contains() public method

Check if the range contains the given value.
public Contains ( long value ) : System.Boolean
value long
return System.Boolean

Intersects() public method

Check if this object intersects with the given range. Start positions are inclusive and End positions are exclusive.
public Intersects ( LongRange range ) : System.Boolean
range LongRange
return System.Boolean

IsConsequent() public method

Check if this objects comes RIGHT AFTER or RIGHT BEFORE the given range. That is. this.Start is equal to range.End or vice versa.
public IsConsequent ( LongRange range ) : System.Boolean
range LongRange
return System.Boolean

LongRange() public method

Never ever let a LongRange with an end value that is smaller than or equal to its start value
public LongRange ( long start, long end ) : System
start long
end long
return System

Merge() public method

Merge this LongRange with a one that intersects it.
public Merge ( LongRange range ) : void
range LongRange
return void

TryMerge() public method

Try to merge two Ranges. Do nothing if they are not consecutive or intersecting ranges. Return true if merged, false otherwise.
public TryMerge ( LongRange range ) : System.Boolean
range LongRange
return System.Boolean