DnaPlotLibUtils { public static List<String> getRegulatoryInformation( final Netlist netlist, final TargetDataInstance tdi) throws CelloException { final List<String> rtn = new ArrayList<>(); final Set<String> specified = new HashSet<>(); rtn.add("from_partname,type,to_partname,arrowhead_length,linestyle,linewidth,color"); final Placements placements = netlist.getResultNetlistData().getPlacements(); for (int i = 0; i < placements.getNumPlacement(); i++) { if (i == 1) { break; } final Placement placement = placements.getPlacementAtIdx(i); for (int j = 0; j < placement.getNumPlacementGroup(); j++) { final PlacementGroup group = placement.getPlacementGroupAtIdx(j); for (int k = 0; k < group.getNumComponent(); k++) { final org.cellocad.v2.results.placing.placement.Component component = group.getComponentAtIdx(k); final String n = component.getNode(); if (n == null) { continue; } final NetlistNode node = netlist.getVertexByName(n); if (LSResultsUtils.isAllInput(node) || LSResultsUtils.isAllOutput(node)) { continue; } final String gateType = node.getResultNetlistNodeData().getDeviceName(); final Gate gate = tdi.getGates().findCObjectByName(gateType); final Structure gs = gate.getStructure(); final Color color = gate.getColor(); for (int l = 0; l < component.getNumPart(); l++) { final String obj = component.getPartAtIdx(l); final Collection<String> deviceParts = DnaPlotLibUtils.unNestDevice(obj, component, netlist, tdi); if (deviceParts.size() == 0) { deviceParts.add(obj); } for (final String p : deviceParts) { final Part part = tdi.getParts().findCObjectByName(p); if (part.getPartType().equals("cds")) { final Collection<String> fields = new ArrayList<>(); fields.add(part.getName()); fields.add(DnaPlotLibUtils.S_REPRESSION); fields.add(gs.getOutputs().get(0)); fields.add(String.valueOf(3)); fields.add("-"); fields.add(""); fields.add(DnaPlotLibUtils.getRgb(color)); final String str = String.join(",", fields); specified.add(str); } } } } } } rtn.addAll(specified); return rtn; }  static void writeCSV(final Collection<String> records, final File file); static String getRgb(final Color color); static String getPartType(final String type); static List<String> getDnaDesigns(final Netlist netlist, final TargetDataInstance tdi); static List<String> getPartsInformation(
      final Netlist netlist, final TargetDataInstance tdi); static List<String> getRegulatoryInformation(
      final Netlist netlist, final TargetDataInstance tdi);  }
@Test public void getRegulatoryInformation_MockNetlist_ShouldReturnFourInteractions() throws CelloException { final List<String> reg = DnaPlotLibUtils.getRegulatoryInformation( DnaPlotLibUtilsTest.netlist, DnaPlotLibUtilsTest.tdi); assert reg.size() == 4; }
@Test public void getRegulatoryInformation_MockNetlist_ShouldReturnExactMatch() throws CelloException { final List<String> reg = DnaPlotLibUtils.getRegulatoryInformation( DnaPlotLibUtilsTest.netlist, DnaPlotLibUtilsTest.tdi); assert reg.get(2).equals("AmtR,Repression,pAmtR,3,-,,0.23;0.66;0.88"); }