mirror of
https://github.com/MillironX/SequenceVariation.jl.git
synced 2024-11-22 13:29:56 +00:00
Add isless
function for Edit
This commit is contained in:
parent
2ff4181dd8
commit
860ce56b34
1 changed files with 7 additions and 0 deletions
|
@ -17,6 +17,13 @@ end
|
||||||
Base.length(e::Edit) = length(_mutation(e))
|
Base.length(e::Edit) = length(_mutation(e))
|
||||||
Base.:(==)(e1::Edit, e2::Edit) = e1.pos == e2.pos && e1.x == e2.x
|
Base.:(==)(e1::Edit, e2::Edit) = e1.pos == e2.pos && e1.x == e2.x
|
||||||
Base.hash(x::Edit, h::UInt) = hash(Edit, hash((x.x, x.pos), h))
|
Base.hash(x::Edit, h::UInt) = hash(Edit, hash((x.x, x.pos), h))
|
||||||
|
function Base.isless(x::Edit, y::Edit)
|
||||||
|
if leftposition(x) == leftposition(y)
|
||||||
|
return length(x) < length(y)
|
||||||
|
end
|
||||||
|
|
||||||
|
return leftposition(x) < leftposition(y)
|
||||||
|
end
|
||||||
|
|
||||||
function Base.parse(::Type{T}, s::AbstractString) where {T<:Edit{Se,Sy}} where {Se,Sy}
|
function Base.parse(::Type{T}, s::AbstractString) where {T<:Edit{Se,Sy}} where {Se,Sy}
|
||||||
return parse(T, String(s))
|
return parse(T, String(s))
|
||||||
|
|
Loading…
Reference in a new issue