/** * The connections between parent and child neurons. * * Contains the neurons which it connects, and the weights between them. * * @author Jeff Chen * @version %I%,%G% */ public class Edge{ private Neuron parent; private Neuron child; private double weight; private double output; /** * Creates the Edge with the specified parent and child Neurons. * * @param parent the parent Neuron * @param child the child Neuron */ public Edge(Neuron parent, Neuron child){ this.parent=parent; this.child=child; } /** * Gets the child Neuron. * * @return the child Neuron */ public Neuron getChild(){ return child; } /** * Gets the output from the parent Neuron. * * @return the output from the parent Neuron */ public double getOutput(){ return output; } /** * Gets the parent Neuron. * * @return the parent Neuron */ public Neuron getParent(){ return parent; } /** * Gets the weight from the child Neuron to the parent Neuron. * * @return the weight from the child Neuron */ public double getWeight(){ return weight; } /** * Sets the child Neuron to the specified Neuron. * * @param child the new child Neuron */ public void setChild(Neuron child){ this.child=child; } /** * Sets the output from the parent Neuron. * * @param output the output from the parent Neuron */ public void setOutput(double output){ this.output=output; } /** * Sets the parent Neuron to the specified Neuron. * * @param parent the new parent Neuron */ public void setParent(Neuron parent){ this.parent=parent; } /** * Sets the weight from the child Neuron. * * This weight is the weight from the child Neuron to the parent Neuron, * and should be updated every time the weights in the child are changed, * for fast and accurate lookup while training the neural network. * * @param weight the weight from the child Neuron to the parent Neuron */ public void setWeight(double weight){ this.weight=weight; } }