Skip to content

Commit

Permalink
Remove polymorphic
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Apr 11, 2024
1 parent 4633a86 commit 4b86ef5
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions RadixWallet/Core/FeaturePrelude/Extensions/AnyRange.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,3 @@ extension AnyRange {
lowerBound != nil && lowerBound == upperBound
}
}

extension AnyRange {
public func contains(_ otherRange: AnyRange) -> Bool {
switch (otherRange.lowerBound, otherRange.upperBound) {
case let (lowerBound?, upperBound?):
contains(lowerBound) && contains(upperBound)
case (let lowerBound?, nil):
contains(lowerBound) && upperBound == nil
case (nil, let upperBound?):
lowerBound == nil && contains(upperBound)
case (nil, nil):
lowerBound == nil && upperBound == nil
}
}

public var polymorphic: PolyMorhpic {
switch (lowerBound, upperBound) {
case let (lowerBound?, upperBound?):
.range(lowerBound ..< upperBound)
case (let lowerBound?, nil):
.partialRangeFrom(lowerBound...)
case (nil, let upperBound?):
.partialRangeUpTo(..<upperBound)
case (nil, nil):
.unboundedRange
}
}

public enum PolyMorhpic: Sendable {
case range(Range<Bound>)
case partialRangeFrom(PartialRangeFrom<Bound>)
case partialRangeUpTo(PartialRangeUpTo<Bound>)
case unboundedRange
}
}

0 comments on commit 4b86ef5

Please sign in to comment.