Alrium/src/block.rs
2015-10-02 18:19:31 +02:00

33 lines
652 B
Rust

use action::Action;
use std::vec;
trait Block {
fn get_connections(&self) -> &Vec<f64>;
fn get_value(&self) -> &f64;
fn get_name(&self) -> &'static str;
fn compute(&self) -> Vec<Action>;
fn clean(&self);
}
struct NeuronBlock {
connections: Vec<f64>,
current_value: f64,
new_value: f64,
}
impl Block for NeuronBlock {
fn get_connections(&self) -> &Vec<f64> {
&self.connections
}
fn get_value(&self) -> &f64 {
&self.current_value
}
fn get_name(&self) -> &'static str {
"Neuron"
}
fn compute(&self) -> Vec<Action> {
Vec::new()
}
fn clean(&self) { }
}