private BasicModel parseBasicModel(String expr) { if ("Be".equals(expr)) { return new BasicModelBE(); } else if ("D".equals(expr)) { return new BasicModelD(); } else if ("G".equals(expr)) { return new BasicModelG(); } else if ("I(F)".equals(expr)) { return new BasicModelIF(); } else if ("I(n)".equals(expr)) { return new BasicModelIn(); } else if ("I(ne)".equals(expr)) { return new BasicModelIne(); } else if ("P".equals(expr)) { return new BasicModelP(); } else { throw new RuntimeException("Invalid basicModel: " + expr); } }
/** LUCENE-3566 */ public void testParameterC() throws Exception { Similarity sim = getSimilarity("text_paramc"); assertEquals(DFRSimilarity.class, sim.getClass()); DFRSimilarity dfr = (DFRSimilarity) sim; assertEquals(BasicModelP.class, dfr.getBasicModel().getClass()); assertEquals(AfterEffectL.class, dfr.getAfterEffect().getClass()); assertEquals(NormalizationH2.class, dfr.getNormalization().getClass()); NormalizationH2 norm = (NormalizationH2) dfr.getNormalization(); assertEquals(7f, norm.getC(), 0.01f); }