• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

numenta / htm.java / #1206

26 Jan 2015 12:57PM UTC coverage: 14.404% (-0.005%) from 14.409%
#1206

push

David Ray
Merge pull request #168 from cogmission/network_api_work

testing the RNG is not part of the scope

714 of 4957 relevant lines covered (14.4%)

0.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/org/numenta/nupic/model/Synapse.java
1
/* ---------------------------------------------------------------------
2
 * Numenta Platform for Intelligent Computing (NuPIC)
3
 * Copyright (C) 2014, Numenta, Inc.  Unless you have an agreement
4
 * with Numenta, Inc., for a separate license for this software code, the
5
 * following terms and conditions apply:
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License version 3 as
9
 * published by the Free Software Foundation.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 * See the GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see http://www.gnu.org/licenses.
18
 *
19
 * http://numenta.org/licenses/
20
 * ---------------------------------------------------------------------
21
 */
22

23
package org.numenta.nupic.model;
24

25
import org.numenta.nupic.Connections;
26
import org.numenta.nupic.research.TemporalMemory;
27

28
/**
29
 * Represents a connection with varying strength which when above 
30
 * a configured threshold represents a valid connection. 
31
 * 
32
 * IMPORTANT:         For DistalDendrites, there is only one synapse per pool, so the
33
 *                                 synapse's index doesn't really matter (in terms of tracking its
34
 *                                 order within the pool. In that case, the index is a global counter
35
 *                                 of all distal dendrite synapses.
36
 * 
37
 *                                 For ProximalDendrites, there are many synapses within a pool, and in
38
 *                                 that case, the index specifies the synapse's sequence order within
39
 *                                 the pool object, and may be referenced by that index.
40
 *    
41
 * 
42
 * @author Chetan Surpur
43
 * @author David Ray
44
 * 
45
 * @see DistalDendrite
46
 * @see TemporalMemory.Connections
47
 */
48
public class Synapse {
49
    private Cell sourceCell;
50
    private Segment segment;
51
    private Pool pool;
52
    private int synapseIndex;
53
    private int inputIndex;
54
    
55
    
56
    /**
57
     * Constructor used when setting parameters later.
58
     */
59
    public Synapse() {}
60
    
×
61
    /**
62
     * Constructs a new {@code Synapse}
63
     * 
64
     * @param c             the connections state of the temporal memory
65
     * @param sourceCell    the {@link Cell} which will activate this {@code Synapse}
66
     * @param segment       the owning dendritic segment
67
     * @param pool                    this {@link Pool} of which this synapse is a member
68
     * @param index         this {@code Synapse}'s index
69
     * @param inputIndex        the index of this {@link Synapse}'s input; be it a Cell or InputVector bit.
70
     */
71
    public Synapse(Connections c, Cell sourceCell, Segment segment, Pool pool, int index, int inputIndex) {
72
        this.sourceCell = sourceCell;
×
73
        this.segment = segment;
×
74
        this.pool = pool;
×
75
                this.synapseIndex = index;
×
76
        this.inputIndex = inputIndex;
×
77
        
×
78
        // If this isn't a synapse on a proximal dendrite
79
        if(sourceCell != null) {
80
                sourceCell.addReceptorSynapse(c, this);
×
81
        }
×
82
    }
83
    
×
84
    /**
85
     * Returns this {@code Synapse}'s index.
86
     * @return
87
     */
88
    public int getIndex() {
89
            return synapseIndex;
90
    }
×
91
    
92
    /**
93
     * Returns the index of this {@code Synapse}'s input item
94
     * whether it is a "sourceCell" or inputVector bit.
95
     * @return
96
     */
97
    public int getInputIndex() {
98
            return inputIndex;
99
    }
×
100
    
101
    /**
102
     * Returns this {@code Synapse}'s degree of connectedness.
103
     * @return
104
     */
105
    public double getPermanence() {
106
        return pool.getPermanence(this);
107
    }
×
108
    
109
    /**
110
     * Sets this {@code Synapse}'s degree of connectedness.
111
     * @param perm
112
     */
113
    public void setPermanence(Connections c, double perm) {
114
        pool.setPermanence(c, this, perm);
115
    }
×
116
    
×
117
    /**
×
118
     * Returns the owning dendritic segment
119
     * @return
120
     */
121
    public Segment getSegment() {
122
        return segment;
123
    }
124
    
×
125
    /**
126
     * Returns the containing {@link Cell} 
127
     * @return
128
     */
129
    public Cell getSourceCell() {
130
        return sourceCell;
131
    }
132
    
×
133
    /**
134
     * {@inheritDoc}
135
     */
136
    public String toString() {
137
        return "" + synapseIndex;
138
    }
139
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc