📄 connection.java
字号:
package net.openai.ai.nn.network;import java.io.*;public class Connection implements Serializable { // the neuron the connection is from Neuron fromNeuron = null; // the neuron the connection is to Neuron toNeuron = null; // the weight associated with this connection Weight weight = null; public Connection() { weight = new Weight(); } // creates a connection object based on the two // neurons passed in as arguments public Connection(Neuron fromNeuron, Neuron toNeuron) { if(fromNeuron != null && toNeuron != null) { this.fromNeuron = fromNeuron; this.toNeuron = toNeuron; } } /** * * Set the from neuron * @param fromNeuron The neuron which the connection is to come from. */ public void setFromNeuron(Neuron fromNeuron) { if(fromNeuron != null) this.fromNeuron = fromNeuron; } /** * * Get the from neuron * @return Neuron The neuron which the connection comes from. */ public Neuron getFromNeuron() { return fromNeuron; } /** * * Set the to neuron. * @param toNeuron The neuron which the connection is to go to. */ public void setToNeuron(Neuron toNeuron) { if(toNeuron != null) this.toNeuron = toNeuron; } /** * * Get the to neuron. * @return Neuron The neuron which the connection goes to. */ public Neuron getToNeuron() { return toNeuron; } /** * * Set the weight to be associated with this connection. * @param weight The weight to associate with this connection. */ public void setWeight(Weight weight) { if(weight != null) this.weight = weight; } /** * * Get the weight associated with this connection. * @return Weight The weight associated with this connection. */ public Weight getWeight() { return weight; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -