Skip to content
Snippets Groups Projects
Commit 828a83b9 authored by POLITO Guillermo Andres's avatar POLITO Guillermo Andres
Browse files

Scaladocs for [[NeuronEntityRef]]s

parent 5d7a6d07
Branches
No related tags found
No related merge requests found
Showing
with 31 additions and 12 deletions
...@@ -2,6 +2,12 @@ package fr.univ_lille.cristal.emeraude.n2s3.features.builder ...@@ -2,6 +2,12 @@ package fr.univ_lille.cristal.emeraude.n2s3.features.builder
import fr.univ_lille.cristal.emeraude.n2s3.features.builder.connection.{ConnectionSet, ExternalConnectionPolicy} import fr.univ_lille.cristal.emeraude.n2s3.features.builder.connection.{ConnectionSet, ExternalConnectionPolicy}
/**
* Models a connection between two neuron groups.
* @param from [[NeuronGroupRef]] origin of the connection
* @param to [[NeuronGroupRef]] destination of the connection
* @param connectionType the kind of connection used
*/
class ConnectionRef(from: NeuronGroupRef, to: NeuronGroupRef, connectionType: ExternalConnectionPolicy) { class ConnectionRef(from: NeuronGroupRef, to: NeuronGroupRef, connectionType: ExternalConnectionPolicy) {
var deployed = false var deployed = false
......
...@@ -8,7 +8,7 @@ import fr.univ_lille.cristal.emeraude.n2s3.support.io.{Input, InputSeq, N2S3Inpu ...@@ -8,7 +8,7 @@ import fr.univ_lille.cristal.emeraude.n2s3.support.io.{Input, InputSeq, N2S3Inpu
/** /**
* An [[InputNeuronGroupRef]] is a [[NeuronGroupRef]] that includes input neurons and is bound to a stream of data. * [[NeuronGroupRef]] that includes input neurons and is bound to a stream of data.
* This input neuron group contains as many neurons as the dimension of the input. I.e. if the input has a dimension of 748 bits, then the input neuron group will contain 748 neurons. * This input neuron group contains as many neurons as the dimension of the input. I.e. if the input has a dimension of 748 bits, then the input neuron group will contain 748 neurons.
* Each of the input neurons can be connected to neurons of another neuron group. * Each of the input neurons can be connected to neurons of another neuron group.
* *
......
...@@ -14,8 +14,8 @@ import fr.univ_lille.cristal.emeraude.n2s3.support.actors.{Message, _} ...@@ -14,8 +14,8 @@ import fr.univ_lille.cristal.emeraude.n2s3.support.actors.{Message, _}
import fr.univ_lille.cristal.emeraude.n2s3.support.io.{Input, InputSeq, N2S3Input} import fr.univ_lille.cristal.emeraude.n2s3.support.io.{Input, InputSeq, N2S3Input}
/** /**
* Main Simulator class. * Main Simulation class.
* An instance of N2S3 represents a simulation. A simulation is built by adding neuron groups to it, making connections between them and then observing the neuron using specific observers. * Represents a simulation. A simulation is built by adding neuron groups to it, making connections between them and then observing the neuron using specific observers.
* *
* N2S3's API hides the usage of actors to the end-user. It provides specific reference objects. These reference objects provide a clean, typed and synchronous API to interact with the underlying system. * N2S3's API hides the usage of actors to the end-user. It provides specific reference objects. These reference objects provide a clean, typed and synchronous API to interact with the underlying system.
* *
......
...@@ -3,21 +3,30 @@ import fr.univ_lille.cristal.emeraude.n2s3.core.{ExternalSender, NetworkEntityPa ...@@ -3,21 +3,30 @@ import fr.univ_lille.cristal.emeraude.n2s3.core.{ExternalSender, NetworkEntityPa
import fr.univ_lille.cristal.emeraude.n2s3.support.actors.Message import fr.univ_lille.cristal.emeraude.n2s3.support.actors.Message
/** /**
* Created by guille on 8/4/16. * Reference to an network entity.
* It contains a [[NetworkEntityPath]] to the referenced entity and provides facility methods to communicate with it.
*/ */
trait N2S3ActorRef { trait NetworkEntityRef {
var actorPath: Option[NetworkEntityPath] = None var actorPath: Option[NetworkEntityPath] = None
def setActor(path: NetworkEntityPath) = this.actorPath = Some(path) def setActor(path: NetworkEntityPath) = this.actorPath = Some(path)
def getNetworkAddress = this.actorPath.get def getNetworkAddress = this.actorPath.get
/**
* Returns a boolean that indicates wether the actor of this ref is already deployed
*/
def isDeployed = this.actorPath.nonEmpty def isDeployed = this.actorPath.nonEmpty
/**
* Sends a message to the entity without waiting for an answer
*/
def send(message: Message): Unit = { def send(message: Message): Unit = {
ExternalSender.sendTo(this.actorPath.get, message ) ExternalSender.sendTo(this.actorPath.get, message )
} }
/**
* Sends a message to the entity and waits for it to answer
*/
def ask(message: Message): Unit = { def ask(message: Message): Unit = {
ExternalSender.askTo(this.actorPath.get, message ) ExternalSender.askTo(this.actorPath.get, message )
} }
......
...@@ -3,7 +3,7 @@ package fr.univ_lille.cristal.emeraude.n2s3.features.builder ...@@ -3,7 +3,7 @@ package fr.univ_lille.cristal.emeraude.n2s3.features.builder
import akka.actor.ActorRef import akka.actor.ActorRef
/** /**
* Created by guille on 6/2/16. * A reference to a neuron group observer
*/ */
abstract class NeuronGroupObserverRef { abstract class NeuronGroupObserverRef {
var deployed: Boolean = false var deployed: Boolean = false
......
...@@ -14,7 +14,7 @@ import scala.collection.mutable.ArrayBuffer ...@@ -14,7 +14,7 @@ import scala.collection.mutable.ArrayBuffer
/** /**
* Created by guille on 6/2/16. * Created by guille on 6/2/16.
*/ */
class NeuronGroupRef(n2s3: N2S3) extends N2S3ActorRef { class NeuronGroupRef(n2s3: N2S3) extends NetworkEntityRef {
var identifier: String = "" var identifier: String = ""
......
...@@ -3,9 +3,11 @@ package fr.univ_lille.cristal.emeraude.n2s3.features.builder ...@@ -3,9 +3,11 @@ package fr.univ_lille.cristal.emeraude.n2s3.features.builder
import fr.univ_lille.cristal.emeraude.n2s3.core._ import fr.univ_lille.cristal.emeraude.n2s3.core._
/** /**
* Created by guille on 7/29/16. * [[NetworkEntityRef]] that refers to a neuron inside the simulation
* @param group a ref to the neuron group that contains the neuron
* @param index the index of the neuron in [[group]]
*/ */
class NeuronRef(val group: NeuronGroupRef, val index: Int) extends N2S3ActorRef { class NeuronRef(val group: NeuronGroupRef, val index: Int) extends NetworkEntityRef {
def getIdentifier: Any = this.group.getIdentifierOf(this) def getIdentifier: Any = this.group.getIdentifierOf(this)
def newNeuron(): NetworkEntity = group.defaultNeuronConstructor() def newNeuron(): NetworkEntity = group.defaultNeuronConstructor()
def isConnectedTo(aNeuron: NeuronRef) = group.isConnected(this, aNeuron) def isConnectedTo(aNeuron: NeuronRef) = group.isConnected(this, aNeuron)
......
...@@ -6,9 +6,11 @@ import fr.univ_lille.cristal.emeraude.n2s3.core._ ...@@ -6,9 +6,11 @@ import fr.univ_lille.cristal.emeraude.n2s3.core._
import fr.univ_lille.cristal.emeraude.n2s3.support.actors.Message import fr.univ_lille.cristal.emeraude.n2s3.support.actors.Message
/** /**
* Created by guille on 8/5/16. * [[NetworkEntityRef]] that goes always through the synchronizer.
* @param synchronizerActor the synchronizer actor ref to pass by
* @param neuronRef the neuron ref that is being targetted
*/ */
class SynchronizedNeuronRef(synchronizerActor: ActorRef, neuronRef: NeuronRef) extends N2S3ActorRef { class SynchronizedNeuronRef(synchronizerActor: ActorRef, neuronRef: NeuronRef) extends NetworkEntityRef {
this.setActor(NetworkEntityPath(synchronizerActor)) this.setActor(NetworkEntityPath(synchronizerActor))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment