{"size": 1232, "ext": "js", "max_stars_repo_path": "neuron.js", "max_stars_repo_name": "Makae/NeuronJS", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "neuron.js", "max_issues_repo_name": "Makae/NeuronJS", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "neuron.js", "max_forks_repo_name": "Makae/NeuronJS", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.6140350877, "max_line_length": 53, "alphanum_fraction": 0.6144480519}
var Neuron = (function() {
    
    var NEURON_CTR = 0;

    function Neuron(bias, axion, dendrites) {
        this.neuron_id = NEURON_CTR++;

        this.bias = bias || 0;
        this.dendrites = dendrites || [];
        this.axion = axion ||null;
    }

    return Neuron;
})();

Neuron.prototype.getIndex = function() {
    return this.neuron_id;
};

Neuron.prototype.getDendriteOutputSum = function() {
    var value = 0;
    for(var i = 0; i<this.dendrites.length; i++)
        value += this.dendrites[i].getOutput();
    return value + this.bias;
};

Neuron.prototype.addDendrite = function(dendrite) {
    this.dendrites.push(dendrite);
    return this;
};

Neuron.prototype.setBias = function(bias) {
    this.bias = bias;
};

Neuron.prototype.setAxion = function(axion) {
    this.axion = axion;
    this.axion.setNeuron(this);

    return this;
};

Neuron.prototype.getOutput = function() {
    return this.getDendriteOutputSum();
};

Neuron.prototype.getAxion = function() {
    return this.axion;
};

Neuron.prototype.getDendrites = function() {
    return this.dendrites;
};

Neuron.prototype.hasDendrites = function() {
    return this.dendrites.length > 0;
};