struct Lapper::Interval(T)
- Lapper::Interval(T)
- Struct
- Value
- Object
Overview
Represent an interval that can hold a val of any type
Included Modules
- Comparable(Lapper::Interval(T))
Defined in:
lapper.crConstructors
-
.new(start : Int32, stop : Int32, val : T)
Creates an
Interval
iv = Interval(String).new(5, 10, "chr1")
Instance Method Summary
-
#<=>(other : self)
Compare two intervals
-
#intersect(other : self) : Int32
Compute the intersect between two intervals
iv = Interval(Int32).new(0, 5, 0) iv.intersect(Interval(Int32).new(4, 6, 0)) # => 1
-
#overlap(start : Int32, stop : Int32) : Bool
Compute wheter self overlaps a range
iv = Interval(Int32).new(0, 5, 0) iv.overlap(4, 6) # => true
- #start
- #stop
- #val
Constructor Detail
def self.new(start : Int32, stop : Int32, val : T)
#
Creates an Interval
iv = Interval(String).new(5, 10, "chr1")
Instance Method Detail
def intersect(other : self) : Int32
#
Compute the intersect between two intervals
iv = Interval(Int32).new(0, 5, 0)
iv.intersect(Interval(Int32).new(4, 6, 0)) # => 1
def overlap(start : Int32, stop : Int32) : Bool
#
Compute wheter self overlaps a range
iv = Interval(Int32).new(0, 5, 0)
iv.overlap(4, 6) # => true