/*
* (C) 2003-2009 Spolecne s.r.o.
* Author: Tomas Straka
* www.spoledge.com
*
* Written permission must be obtained in advance from Spolecne s.r.o for any form of
* reproduction, use or distribution.
*/
package ants.models.thrakia;
import java.util.HashMap;
import java.util.HashSet;
/**
* The genetic information encoded in <i>Zygothic graph</i> tells, shortly, what <i>Mediators</i>
* are produced if the neuron is in <i>Cumulative state</i> on a given <i>Mediator</i>. The neuro transmitters
* are characterised by <i>Zygothic graph</i> allowing to produce themself, ie. <i>A -> A</i>
*/
public class ZygothicGraph
{
public enum Mediator {
BLACK, RED, BLUE, CYAN, ORANGE
}
private HashMap<Mediator, HashSet<Mediator>> graph;
public ZygothicGraph() {
graph = new HashMap<Mediator, HashSet<Mediator>>();
for( Mediator m : Mediator.values() ) {
HashSet<Mediator> target = new HashSet<Mediator>();
target.add( m );
graph.put( m, target );
}
add( Mediator.ORANGE, Mediator.CYAN );
add( Mediator.CYAN, Mediator.BLUE );
}
/**
* Used only by the constructor, if the <i>Zyghotic graph</i> is more complex
*/
private void add( Mediator from, Mediator to ) {
HashSet<Mediator> target = graph.get( from );
target.add( to );
}
/**
* Returns all mediators produced by neuron in <i>Cumulative state</i> cumulativeState
*/
public HashSet<Mediator> getProduction( Mediator cumulativeState ) {
return graph.get(cumulativeState);
}
}
|