forked from MrBly/WalnutiQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDistalSegment.java
56 lines (46 loc) · 1.64 KB
/
DistalSegment.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package model.MARK_II;
/**
* @author Quinn Liu ([email protected])
* @version April 25, 2014
*/
public class DistalSegment extends Segment {
/**
* same as sequenceSegment
*/
private boolean predictsFeedForwardInputOnNextTimeStep;
private boolean wasActive;
public DistalSegment() {
super();
this.predictsFeedForwardInputOnNextTimeStep = false;
this.wasActive = false;
}
public void nextTimeStep() {
this.predictsFeedForwardInputOnNextTimeStep = false;
this.wasActive = super.isActive;
//super.isActive = false; Although it may be obvious to put
// this line here it is incorrect becuase Segment recalculates
// it's activeState based on current state of it's Synapses
}
public boolean getSequenceStatePredictsFeedFowardInputOnNextStep() {
return this.predictsFeedForwardInputOnNextTimeStep;
}
public void setSequenceState(boolean predictsFeedForwardInputOnNextTimeStep) {
this.predictsFeedForwardInputOnNextTimeStep = predictsFeedForwardInputOnNextTimeStep;
}
public void setPreviousActiveState(boolean wasActive) {
this.wasActive = wasActive;
}
public boolean getPreviousActiveState() {
return this.wasActive;
}
public int getNumberOfPreviousActiveSynapses() {
int numberOfPreviousActiveSynapses = 0;
for (Synapse synapse : this.synapses) {
if (synapse.isConnected()
&& synapse.getConnectedCell().getPreviousActiveState()) {
numberOfPreviousActiveSynapses++;
}
}
return numberOfPreviousActiveSynapses;
}
}