DGRN { boolean edgePropagatesSignal(Edge edge) throws KeySelectorException { try { int edgeMagnitude = Math.abs((int) edge.getWeight()); int srcPotential = Integer.parseInt(getNodeAttributeValue(edge.getSource(), ACTIVATION_VALUE_ID)); logger.trace("(" + srcPotential + ")-" + edgeMagnitude + "->?"); return srcPotential >= edgeMagnitude; } catch (IllegalStateException ex) { logger.error(edge.getSource().getId() + "->" + edge.getTarget().getId() + " has no weight? : ", ex); return false; } } 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 testSignalShouldNotPropagateEdgeIfNotEnoughSrcNodePotential() throws Exception { DGRN dgrn = getMockDGRN_twoNode(); List<Edge> edges = dgrn.graph.getAllEdges(); Assert.assertEquals(edges.size(), 1); Edge edge = edges.get(0); Assert.assertEquals(dgrn.edgePropagatesSignal(edge), false); }