mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-22 21:39:55 +00:00
refactor: Add Base methods for generic Edit
This commit is contained in:
parent
0b10b9ae7b
commit
1c80158d5b
1 changed files with 4 additions and 3 deletions
|
@ -11,9 +11,10 @@ If insertion: Insertion of length L b/w ref pos `pos:pos+1`
|
||||||
"""
|
"""
|
||||||
abstract type Edit{S<:BioSequence,T<:BioSymbol} end
|
abstract type Edit{S<:BioSequence,T<:BioSymbol} end
|
||||||
|
|
||||||
Base.length(e::Edit) = length(_mutation(e))
|
Base.length(e::Edit) = error("length not implemented for type $(typeof(e))")
|
||||||
Base.:(==)(e1::Edit, e2::Edit) = e1.pos == e2.pos && e1.x == e2.x
|
Base.:(==)(e1::Edit, e2::Edit) = typeof(e1) == typeof(e2) && e1 == e2
|
||||||
Base.hash(x::Edit, h::UInt) = hash(Edit, hash((x.x, x.pos), h))
|
Base.hash(x::Edit, h::UInt) = error("hash not implemented for type $(typeof(x))")
|
||||||
|
|
||||||
function Base.isless(x::Edit, y::Edit)
|
function Base.isless(x::Edit, y::Edit)
|
||||||
if leftposition(x) == leftposition(y)
|
if leftposition(x) == leftposition(y)
|
||||||
return length(x) < length(y)
|
return length(x) < length(y)
|
||||||
|
|
Loading…
Reference in a new issue