コード例 #1
0
 private void checkNeuronAllocation() {
   if (chip.getNumCells() == 0) {
     return;
   }
   if (neurons == null || neurons.getNumCells() != chip.getNumCells()) {
     neurons = new Neurons(this);
   }
 }
コード例 #2
0
 public void annotate(GLAutoDrawable drawable) {
   if (showStateAtMouse == false || neurons == null) {
     return;
   }
   Point p = chip.getCanvas().getMousePixel();
   if (!chip.getCanvas().wasMousePixelInsideChipBounds()) {
     return;
   }
   neurons.display(drawable, p);
 }
コード例 #3
0
 @Override
 public synchronized EventPacket<?> filterPacket(EventPacket<?> in) {
   checkOutputPacketEventType(in);
   checkNeuronAllocation();
   OutputEventIterator outItr = out.outputIterator();
   for (Object o : in) {
     TypedEvent e = (TypedEvent) o;
     if (neurons.stimulate(e)) {
       TypedEvent oe = (TypedEvent) outItr.nextOutput();
       oe.copyFrom(e);
     }
   }
   return out;
 }
コード例 #4
0
 @Override
 public synchronized void resetFilter() {
   if (neurons != null) {
     neurons.initialize(this);
   }
 }
コード例 #5
0
 public synchronized void doClearState() {
   if (neurons != null) {
     neurons.reset();
   }
 }
コード例 #6
0
 public synchronized void doLoadState() {
   checkNeuronAllocation();
   if (neurons != null) {
     neurons.loadState(this);
   }
 }
コード例 #7
0
 public synchronized void doSaveState() {
   if (neurons != null) {
     neurons.saveState();
   }
 }