NodeSplitParameterization extends ConsistencyParameterization { @Override public List<List<Pair<Treatment>>> parameterizeStudy(Study s) { Pair<Treatment> split = new Pair<Treatment>(d_splitNode.getBaseline(), d_splitNode.getSubject()); if (s.getTreatments().size() == 2 || !s.getTreatments().containsAll(split)) { return super.parameterizeStudy(s); } List<Pair<Treatment>> params1 = super.parameterizeStudy(s).get(0); params1.remove(new Pair<Treatment>(getStudyBaseline(s), d_splitNode.getSubject())); List<Pair<Treatment>> params2 = new ArrayList<Pair<Treatment>>(); params2.add(split); List<List<Pair<Treatment>>> params = new ArrayList<List<Pair<Treatment>>>(); params.add(params1); params.add(params2); return params; } NodeSplitParameterization(Network network, BasicParameter splitNode, Tree<Treatment, FoldedEdge<Treatment, Study>> tree, Map<Study, Treatment> baselines); static NodeSplitParameterization create(Network network, BasicParameter split); static List<BasicParameter> getSplittableNodes(Network network); static List<BasicParameter> getSplittableNodes(Hypergraph<Treatment, Study> studyGraph, UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph); static boolean isSplittable(Hypergraph<Treatment, Study> studyGraph, Pair<Treatment> split); static Tree<Treatment, FoldedEdge<Treatment, Study>> findSpanningTree(UndirectedGraph<Treatment, FoldedEdge<Treatment, Study>> cGraph, BasicParameter split); static Map<Study, Treatment> findStudyBaselines(Hypergraph<Treatment, Study> studyGraph, Tree<Treatment, FoldedEdge<Treatment, Study>> tree, BasicParameter split); @Override List<NetworkParameter> getParameters(); @Override Map<NetworkParameter, Integer> parameterize(Treatment ta, Treatment tb); SplitParameter getDirectParameter(); SplitParameter getIndirectParameter(); Map<NetworkParameter, Integer> parameterizeIndirect(); @Override List<List<Pair<Treatment>>> parameterizeStudy(Study s); BasicParameter getSplitNode();  }
@SuppressWarnings("unchecked") @Test public void testParameterizeStudy() { Study s1 = new Study("1"); s1.getMeasurements().addAll(Arrays.asList(new Measurement(d_ta), new Measurement(d_tb))); Study s2 = new Study("2"); s2.getMeasurements().addAll(Arrays.asList(new Measurement(d_tc), new Measurement(d_td))); Study s3 = new Study("3"); s3.getMeasurements().addAll(Arrays.asList(new Measurement(d_ta), new Measurement(d_tb), new Measurement(d_tc), new Measurement(d_td))); Network network = new Network(); network.getTreatments().addAll(Arrays.asList(d_ta, d_tb, d_tc, d_td)); network.getStudies().addAll(Arrays.asList(s1, s2, s3)); BasicParameter split = new BasicParameter(d_ta, d_tc); NodeSplitParameterization pmtz = NodeSplitParameterization.create(network, split); assertEquals(new BasicParameter(d_tb, d_ta), pmtz.getParameters().get(0)); assertEquals(Collections.singletonList(Collections.singletonList(new Pair<Treatment>(d_tb, d_ta))), pmtz.parameterizeStudy(s1)); List<Pair<Treatment>> l1 = Arrays.asList(new Pair<Treatment>(d_tb, d_ta), new Pair<Treatment>(d_tb, d_td)); List<Pair<Treatment>> l2 = Arrays.asList(new Pair<Treatment>(d_ta, d_tc)); List<List<Pair<Treatment>>> expected = Arrays.asList(l1, l2); assertEquals(expected, pmtz.parameterizeStudy(s3)); NodeSplitParameterization pmtz2 = NodeSplitParameterization.create(d_network, new BasicParameter(d_ta, d_tb)); assertEquals(Collections.singletonList(Collections.singletonList(new Pair<Treatment>(d_ta, d_tb))), pmtz2.parameterizeStudy(d_s1)); }