From bc048c12bb26dae0bb94bc46c83409ebd31703c6 Mon Sep 17 00:00:00 2001 From: nHackel Date: Tue, 22 Aug 2023 13:15:00 +0000 Subject: [PATCH] Remove similar method --- src/AlgorithmInterface.jl | 5 ---- src/MiscAlgorithms/MiscAlgorithms.jl | 3 +-- src/MiscAlgorithms/SimilarAlgorithm.jl | 34 -------------------------- 3 files changed, 1 insertion(+), 41 deletions(-) delete mode 100644 src/MiscAlgorithms/SimilarAlgorithm.jl diff --git a/src/AlgorithmInterface.jl b/src/AlgorithmInterface.jl index 0a7675e..f8a1f6b 100644 --- a/src/AlgorithmInterface.jl +++ b/src/AlgorithmInterface.jl @@ -31,10 +31,5 @@ function process(algo::AbstractImageReconstructionAlgorithm, data, params::Vecto return val end -export similar -similar(algo::AbstractImageReconstructionAlgorithm, data) = error("$(typeof(algo)) must implement similar") -similar(algo::AbstractImageReconstructionAlgorithm, data, param::AbstractImageReconstructionParameter) = similar(typeof(algo), data, param) -similar(algoT::Type{T}, data, param::AbstractImageReconstructionParameter) where {T<:AbstractImageReconstructionAlgorithm} = deepcopy(param) - export parameter parameter(algo::AbstractImageReconstructionAlgorithm) = error("$(typeof(algo)) must implement parameter") \ No newline at end of file diff --git a/src/MiscAlgorithms/MiscAlgorithms.jl b/src/MiscAlgorithms/MiscAlgorithms.jl index 5868e76..c18c448 100644 --- a/src/MiscAlgorithms/MiscAlgorithms.jl +++ b/src/MiscAlgorithms/MiscAlgorithms.jl @@ -1,2 +1 @@ -include("RuntimeAlgorithms.jl") -include("SimilarAlgorithm.jl") \ No newline at end of file +include("RuntimeAlgorithms.jl") \ No newline at end of file diff --git a/src/MiscAlgorithms/SimilarAlgorithm.jl b/src/MiscAlgorithms/SimilarAlgorithm.jl deleted file mode 100644 index da5c47a..0000000 --- a/src/MiscAlgorithms/SimilarAlgorithm.jl +++ /dev/null @@ -1,34 +0,0 @@ -export SimilarAlgorithm, SimilarAlgorithmParameter -Base.@kwdef struct SimilarAlgorithmParameter <: AbstractImageReconstructionParameter - algo::AbstractImageReconstructionAlgorithm -end - -mutable struct SimilarAlgorithm <: AbstractImageReconstructionAlgorithm - params::SimilarAlgorithmParameter - algo::AbstractImageReconstructionAlgorithm - outputChannel::Channel{Any} -end - -SimilarAlgorithm(params::SimilarAlgorithmParameter) = SimilarAlgorithm(params, params.algo, Channel{Any}(Inf)) - -take!(algo::SimilarAlgorithm) = take!(algo.outputChannel) -function put!(algo::SimilarAlgorithm, u) - result = nothing - try - put!(algo.algo, u) - result = take!(algo.algo) - catch e - try - similarAlgo = similar(algo.algo, u) - put!(similarAlgo, u) - result = take!(similarAlgo) - algo.algo = similarAlgo - catch e2 - throw(e) - end - end - put!(algo.outputChannel, result) -end - -parameter(algo::SimilarAlgorithm) = algo.params -similar(algo::SimilarAlgorithm, data) = algo.algo = similar(algo.algo, data) \ No newline at end of file