private PriorFunction getPrior() { switch(prior) { case L1: return new L1(); case L2: return prior.custom ? new L2(prior.param) : new L2(); case elastic: return prior.custom ? new ElasticBandPrior(prior.param) : new ElasticBandPrior(); case uniform: return new UniformPrior(); case t: if (!prior.custom) throw new IllegalArgumentException("Must specify df with 'priorParam' in config to use T prior function."); return new TPrior(prior.param); case unknown: return new L2(1); default: return new L2(1); } }