Neuron instances and the links
between them.
Although updating a neuron's state is thread-safe, modifying the
network's topology (adding or removing links) is not.
| Modifier and Type | Class and Description |
|---|---|
| public static class | Network.
Comparator that prescribes an order of the neurons according to the increasing order of their identifier. |
| private static class | Network.
Serialization. |
| Modifier and Type | Field and Description |
|---|---|
| private final int | featureSize
Neuron's features set size. |
| private final ConcurrentHashMap | linkMap
Links. |
| private final ConcurrentHashMap | neuronMap
Neurons. |
| private final AtomicLong | nextId
Next available neuron identifier. |
| private static final long | serialVersionUID
Serializable. |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| public | Network(long
Identifier for the first neuron that
will be added to this network. initialIdentifier, int Size of the neuron's features. featureSize)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| private void | addLinkToLinkSet(Set<Long>
Neuron identifier. linkSet, long Neuron identifier. id)Adds a link to neuron |
| public synchronized Network | Returns: a new instance with the same state as this instance.Performs a deep copy of this instance. |
| public long | Returns: the neuron's identifier.Initial values for the neuron's features. features)Creates a neuron and assigns it a unique identifier. |
| private Long | |
| public void | |
| private void | deleteLinkFromLinkSet(Set<Long>
Neuron identifier. linkSet, long Neuron identifier. id)Deletes a link to neuron |
| public void | |
| public int | |
| public Collection | Returns: the list of neighbours.Neurons for which to retrieve the neighbours. neurons)Retrieves the neurons in the neighbourhood of any neuron in the
|
| public Collection | Returns: the list of neighbours.Neurons for which to retrieve the neighbours. neurons, Iterable<Neuron> Neurons to exclude from the returned list.
Can be exclude)null.Retrieves the neurons in the neighbourhood of any neuron in the
|
| public Collection | Returns: the list of neighbours.Neuron for which to retrieve the neighbours. neuron)Retrieves the neighbours of the given neuron. |
| public Collection | Returns: the list of neighbours.Neuron for which to retrieve the neighbours. neuron, Iterable<Neuron> Neurons to exclude from the returned list.
Can be exclude)null.Retrieves the neighbours of the given neuron. |
| public Neuron | Returns: the neuron associated with the givenid.Identifier. id)Retrieves the neuron with the given (unique) |
| public Collection | Returns: a list of neurons, sorted in the order prescribed by the givencomparator.Comparator used for sorting the neurons.Creates a list of the neurons, sorted in a custom order. |
| public Iterator | |
| private void | |
| private Object |
| featureSize | back to summary |
|---|---|
| private final int featureSize Neuron's features set size. | |
| linkMap | back to summary |
|---|---|
| private final ConcurrentHashMap<Long, Set<Long>> linkMap Links. | |
| neuronMap | back to summary |
|---|---|
| private final ConcurrentHashMap<Long, Neuron> neuronMap Neurons. | |
| nextId | back to summary |
|---|---|
| private final AtomicLong nextId Next available neuron identifier. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable. | |
| Network | back to summary |
|---|---|
| pack-priv Network(long nextId, int featureSize, Neuron[] neuronList, long[][] neighbourIdList) Constructor with restricted access, solely used for deserialization.
| |
| Network | back to summary |
|---|---|
public Network(long initialIdentifier, int featureSize)
| |
| addLink | back to summary |
|---|---|
| public void addLink(Neuron a, Neuron b) Adds a link from neuron Note the link is not bi-directional; if a bi-directional link is
required, an additional call must be made with
| |
| addLinkToLinkSet | back to summary |
|---|---|
| private void addLinkToLinkSet(Set<Long> linkSet, long id) Adds a link to neuron Note no check verifies that the identifier indeed belongs to this network. | |
| copy | back to summary |
|---|---|
| public synchronized Network copy() Performs a deep copy of this instance. Upon return, the copied and original instances will be independent: Updating one will not affect the other.
| |
| createNeuron | back to summary |
|---|---|
| public long createNeuron(double[] features) Creates a neuron and assigns it a unique identifier.
| |
| createNextId | back to summary |
|---|---|
| private Long createNextId() Creates a neuron identifier.
| |
| deleteLink | back to summary |
|---|---|
| public void deleteLink(Neuron a, Neuron b) Deletes the link between neurons
| |
| deleteLinkFromLinkSet | back to summary |
|---|---|
| private void deleteLinkFromLinkSet(Set<Long> linkSet, long id) Deletes a link to neuron Note no check verifies that the identifier indeed belongs to this network. | |
| deleteNeuron | back to summary |
|---|---|
| public void deleteNeuron(Neuron neuron) Deletes a neuron.
Links from all neighbours to the removed neuron will also be
| |
| getFeaturesSize | back to summary |
|---|---|
| public int getFeaturesSize() Gets the size of the neurons' features set.
| |
| getNeighbours | back to summary |
|---|---|
| public Collection Retrieves the neurons in the neighbourhood of any neuron in the
| |
| getNeighbours | back to summary |
|---|---|
| public Collection Retrieves the neurons in the neighbourhood of any neuron in the
| |
| getNeighbours | back to summary |
|---|---|
| public Collection Retrieves the neighbours of the given neuron.
| |
| getNeighbours | back to summary |
|---|---|
| public Collection Retrieves the neighbours of the given neuron.
| |
| getNeuron | back to summary |
|---|---|
| public Neuron getNeuron(long id) Retrieves the neuron with the given (unique)
| |
| getNeurons | back to summary |
|---|---|
| public Collection Creates a list of the neurons, sorted in a custom order.
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream in) Prevents proxy bypass.
| |
| writeReplace | back to summary |
|---|---|
| private Object writeReplace() Custom serialization.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Version identifier. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(Neuron
the first object to be compared. a, Neuron the second object to be compared. b)Implements java. Compares its two arguments for order. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Version identifier. | |
| NeuronIdentifierComparator | back to summary |
|---|---|
| public NeuronIdentifierComparator() | |
| compare | back to summary |
|---|---|
| public int compare(Neuron a, Neuron b) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| Modifier and Type | Field and Description |
|---|---|
| private final int | featureSize
Number of features. |
| private final long[][] | neighbourIdList
Links. |
| private final Neuron[] | neuronList
Neurons. |
| private final long | nextId
Next identifier. |
| private static final long | serialVersionUID
Serializable. |
| Access | Constructor and Description |
|---|---|
| pack-priv | SerializationProxy(long
Next available identifier. nextId, int Number of features. featureSize, Neuron[] Neurons. neuronList, long[][] Links associated to each of the neurons in
neighbourIdList)neuronList.
|
| Modifier and Type | Method and Description |
|---|---|
| private Object |
| featureSize | back to summary |
|---|---|
| private final int featureSize Number of features. | |
| neighbourIdList | back to summary |
|---|---|
| private final long[][] neighbourIdList Links. | |
| neuronList | back to summary |
|---|---|
| private final Neuron[] neuronList Neurons. | |
| nextId | back to summary |
|---|---|
| private final long nextId Next identifier. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable. | |
| SerializationProxy | back to summary |
|---|---|
pack-priv SerializationProxy(long nextId, int featureSize, Neuron[] neuronList, long[][] neighbourIdList)
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() Custom serialization. | |