Review of java interface for constructing brain model I have built a partial human brain model and the following is an example of how I use all the classes. I was wondering if anyone could critique my implementation strategies because I feel like the following setup is very clumsy. You can view all the code at:
https://github.com/quinnliu/WalnutiQ    

public class HowToUseMARK_I extends junit.framework.TestCase {
    private NervousSystem nervousSystem;
    private MemoryClassifier memoryClassifier_Digits;

    private Gson gson;

    public void setUp() throws IOException {
        this.gson = new Gson();
        this.nervousSystem = this.constructConnectedNervousSystem();
        this.memoryClassifier_Digits = this.trainMemoryClassifierWithNervousSystem();
    }

    private NervousSystem constructConnectedNervousSystem() {
        // construct Neocortex with just V1
        Region rootRegionOfNeocortex = new Region("V1", 4, 4, 4, 50, 3);
        RegionToRegionConnect neocortexConnectType = new RegionToRegionRectangleConnect();
        Neocortex unconnectedNeocortex = new Neocortex(rootRegionOfNeocortex,
                neocortexConnectType);

        // construct LGN
        Region LGNRegion = new Region("LGN", 8, 8, 1, 50, 3);
        LateralGeniculateNucleus unconnectedLGN = new LateralGeniculateNucleus(
                LGNRegion);

        // construct Retina
        VisionCell[][] visionCells = new VisionCell[65][65];
        for (int x = 0; x &lt; visionCells.length; x++) {
            for (int y = 0; y &lt; visionCells[0].length; y++) {
                visionCells[x][y] = new VisionCell();
            }
        }
        Retina unconnectedRetina = new Retina(visionCells);

        // construct 1 object of NervousSystem to encapsulate all classes in
        // MARK II
        NervousSystem nervousSystem = new NervousSystem(unconnectedNeocortex,
                unconnectedLGN, unconnectedRetina);

        // connect Retina to LGN
        Retina retina = nervousSystem.getPNS().getSNS().getRetina();

        LateralGeniculateNucleus LGN = nervousSystem.getCNS().getBrain()
                .getThalamus().getLGN();

        SensorCellsToRegionConnect retinaToLGN = new SensorCellsToRegionRectangleConnect();
        retinaToLGN.connect(retina.getVisionCells(), LGN.getRegion(), 0, 0);

        // connect LGN to V1 Region of Neocortex
        Neocortex neocortex = nervousSystem.getCNS().getBrain().getCerebrum()
                .getCerebralCortex().getNeocortex();

        RegionToRegionConnect LGNToV1 = new RegionToRegionRectangleConnect();
        LGNToV1.connect(LGN.getRegion(), neocortex.getCurrentRegion(), 0, 0);

        return nervousSystem;
    }
I would consider making this code:

// construct Retina
VisionCell[][] visionCells = new VisionCell[65][65];
for (int x = 0; x &lt; visionCells.length; x++) {
    for (int y = 0; y &lt; visionCells[0].length; y++) {
        visionCells[x][y] = new VisionCell();
    }
}


a factory method on Retina (passing in the dimensions of the cell array) as it will probably be a common thing to create.
Call chains like these nervousSystem.getPNS().getSNS().getRetina() are a code smell. You could model your nervous system as some kind of repository where you can query the individual components like this:

nervousSystem.getRetina();
nervousSystem.getBrain();


or fully generic (additional bonus points ;))

nervousSystem.get&lt;Retina&gt;();
nervousSystem.get&lt;Brain&gt;();


More complex components like Brain can then be modeled in the same way:

nervousSystem.get&lt;Brain&gt;().get&lt;Neocortex&gt;();


This alleviates the caller from having to know the internal structure.
I find it quite weird that your ctor for the NervousSystem only takes some very specific components of individual subsystems. From the looks of it the NervousSystem is composed out of PNS and CNS with SNS being part of  the PNS and Brain being part of the CNS etc. so I'm wondering why the NervousSystem is not being built like that but gets some very specific subcomponents instead.

I would have thought the setup should look something like this (I haven't checked the code on github so the class names are purely guesswork):

Neocortex neocortex = new Neocortex(...);
CerebralCortex cerebralCortex = new CerebralCortex(neocortex, ...);
Cerebrum cerebrum = new Cerebrum(cerebralCortex, ...);

LateralGeniculateNucleus lgn = new LateralGeniculateNucleus(...);
Thalamus thalamus = new Thalamus(lgn, ...);

Brain brain = new Brain(cerebrum, thalamus, ...);
CNS cns = new CNS(brain, ...);

Retina retina = new Retina(...);
SNS sns = new SNS(retina, ...);
PNS pns = new PNS(sns, ...);

NervousSystem nervousSystem = new NervousSystem(cns, pns);

For wiring individual components up you could pass a WiringStrategy into the NervousSystem which decides how things are wired up (so you can simulate broken wiring for example).