package com.aor.NeuralNets;

import java.util.ArrayList;

public class OutputNode extends Node {

    public OutputNode () {
        _totalInput = 0;
        _ready = false;
        _links = null;
        _inputs = new ArrayList<Link>();
        _id = 0;
    }
    
    public OutputNode (int id) {
        this();
        _id = id;
    }

    public OutputNode clone () {
        return new OutputNode(getId());
    }
    
    @Override
    public String toString () {
        String ans = "";
        ans += "\tID: " + _id + "\n";
        ans += "\tOperation: Output \n";
        return ans;
    }

    public void recieveTrigger (double power) {
        _totalInput += power;
        setReady(true);
    }

    public void sendTrigger () {
        _totalInput = _totalInput * NeuralNets.MAX_INPUT;
        setReady(false);
    }

    public double getOutput () {
        return _totalInput;
    }
}

@@ -89,16 +89,51 @@
 s Node %7B
+%0A    private int _triggersRecieved;
 %0A%0A    pu
@@ -279,24 +279,55 @@
    _id = 0;%0A
+        _triggersRecieved = 0;%0A
     %7D%0A    %0A 
@@ -738,16 +738,45 @@
  power;%0A
+        _triggersRecieved++;%0A
         
@@ -853,16 +853,17 @@
 Input = 
+(
 _totalIn
@@ -865,16 +865,37 @@
 talInput
+ / _triggersRecieved)
  * Neura
@@ -910,16 +910,71 @@
 X_INPUT;
+ //average and normalize%0A        _triggersRecieved = 0;
 %0A       

Make OutputNodes take a proper average of their inputs.