DGRN { public Node getNode(String nodeId) throws KeySelectorException { List<Node> nodes = graph.getNodes(); for (Node node : nodes) { if (node.getId().equals(nodeId)) { return node; } } throw new KeySelectorException("node w/ id '" + nodeId + "' not found!"); } DGRN(String creator, String description, AttributeList attrList, Attribute attributeActivationValue,
                OutflowNodeHandler outflowNodeHandler, InflowNodeHandler inflowNodeHandler); private  DGRN(String creator, String description, AttributeList attrList, Attribute attributeActivationValue,
                 OutflowNodeHandler outflowNodeHandler, InflowNodeHandler inflowNodeHandler, Random randomizer); static int getNodeAttributeIndex(Node node, String attributeId); static void setNodeAttributeValue(Node node, String attributeId, String newValue); static String getNodeAttributeValue(Node node, String attributeId); List<Edge> getAllEdgesOf(Node node); void connect(String nodeId1, String nodeId2, int connectionWeight); void tick(); void inheritGenes(DGRN parent, int maxAlleles); void saveGraph(Gexf gexf); Node getNode(String nodeId); static Attribute attr_ActivationValue; static Attribute attr_AlleleCount; final Random randomGenerator; public Graph graph; final String ACTIVATION_VALUE_ID; }
@Test public void testGetNode() throws KeySelectorException { DGRN dgrn = getMockDGRN(); GraphInitializer.buildLightenCellTestGraph(dgrn); Assert.assertEquals( dgrn.getNode(GraphInitializer.inflowNode.ALWAYS_ON).getId(), GraphInitializer.inflowNode.ALWAYS_ON ); Assert.assertEquals(dgrn.getNode(GraphInitializer.innerNode.TF1).getId(), GraphInitializer.innerNode.TF1); Assert.assertEquals( dgrn.getNode(GraphInitializer.outflowNode.COLOR_LIGHTEN).getId(), GraphInitializer.outflowNode.COLOR_LIGHTEN ); }