NodeSplitParameterization extends ConsistencyParameterization { @Override public Map<NetworkParameter, Integer> parameterize(Treatment ta, Treatment tb) { if (d_splitNode.getBaseline().equals(ta) && d_splitNode.getSubject().equals(tb)) { Map<NetworkParameter, Integer> map = new HashMap<NetworkParameter, Integer>(); map.put(getDirectParameter(), 1); return map; } if (d_splitNode.getBaseline().equals(tb) && d_splitNode.getSubject().equals(ta)) { Map<NetworkParameter, Integer> map = new HashMap<NetworkParameter, Integer>(); map.put(getDirectParameter(), -1); return map; } return super.parameterize(ta, tb); } 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();  }
@Test public void testParameterize() { NodeSplitParameterization pmtz = NodeSplitParameterization.create(d_network, new BasicParameter(d_ta, d_tb)); assertEquals(Collections.singletonMap(new SplitParameter(d_ta, d_tb, true), 1), pmtz.parameterize(d_ta, d_tb)); assertEquals(Collections.singletonMap(new SplitParameter(d_ta, d_tb, true), -1), pmtz.parameterize(d_tb, d_ta)); assertEquals(Collections.singletonMap(new BasicParameter(d_tc, d_ta), -1), pmtz.parameterize(d_ta, d_tc)); Map<NetworkParameter, Integer> expected = new HashMap<NetworkParameter, Integer>(); expected.put(new BasicParameter(d_tc, d_tb), -1); expected.put(new BasicParameter(d_tc, d_td), 1); assertEquals(expected, pmtz.parameterize(d_tb, d_td)); Map<NetworkParameter, Integer> expected2 = new HashMap<NetworkParameter, Integer>(); expected2.put(new BasicParameter(d_tc, d_ta), -1); expected2.put(new BasicParameter(d_tc, d_tb), 1); assertEquals(expected2, pmtz.parameterizeIndirect()); }