-- |
-- Module      :  Languages.UniquenessPeriods.Vector.FuncRepRelated
-- Copyright   :  (c) OleksandrZhabenko 2020
-- License     :  MIT
-- Stability   :  Experimental
-- Maintainer  :  olexandr543@yahoo.com
--
-- Functions to choose from the 'FuncRep' variants.

module Languages.UniquenessPeriods.Vector.FuncRepRelated where

import Languages.UniquenessPeriods.Vector.Data
import String.Languages.UniquenessPeriods.Vector
import Languages.UniquenessPeriods.Vector.PropertiesFuncRep

-- | Allows to choose the variant of the computations in case of usual processment.
chooseMax :: String -> FuncRep String (UniquenessGeneral2 Char) [Float]
chooseMax xs
  | xs == "y0" = procDiverse2F
  | xs == "0y" = procRhythmicity23F
  | xs == "y" = procBothF
  | otherwise = procBothInvF

-- | Allows to choose the variant of the computations in case of minimum lookup. Uses @-neg@ variants.
chooseMin :: String -> FuncRep String (UniquenessGeneral2 Char) [Float]
chooseMin xs
  | xs == "y0" = procDiverse2Fneg
  | xs == "0y" = procRhythmicity23Fneg
  | xs == "y" = procBothFneg
  | otherwise = procBothInvFneg

-- | Allows to choose precision in the Numeric.showFFloat function being given a choice parameter.
precChoice :: String -> Maybe Int
precChoice xs
  | xs == "y0" || xs == "y" || xs == "0y" = Just 0
  | otherwise = Just 4