Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
FromPopulation.cs
1
using
System;
2
using
System.Threading.Tasks;
3
using
System.Xml;
4
using
TAG.Simulator.ObjectModel.Actors
;
5
using
Waher.Content.Xml
;
6
7
namespace
TAG.Simulator.ObjectModel.Events
8
{
12
public
class
FromPopulation
:
SimulationNode
13
{
14
private
IActor
actor;
15
private
string
actorId;
16
22
public
FromPopulation
(
ISimulationNode
Parent
,
Model
Model
)
23
: base(
Parent
,
Model
)
24
{
25
}
26
30
public
override
string
LocalName
=> nameof(
FromPopulation
);
31
35
public
string
ActorId
=> this.actorId;
36
40
public
IActor
Actor
=> this.actor;
41
48
public
override
ISimulationNode
Create
(
ISimulationNode
Parent
,
Model
Model
)
49
{
50
return
new
FromPopulation
(
Parent
,
Model
);
51
}
52
57
public
override
Task
FromXml
(XmlElement Definition)
58
{
59
this.actorId =
XML
.
Attribute
(Definition,
"actor"
);
60
return
Task.CompletedTask;
61
}
62
66
public
override
Task
Initialize
()
67
{
68
if
(!this.
Model
.
TryGetActor
(
this
.actorId, out
this
.actor))
69
throw
new
Exception(
"Actor not found: "
+ this.actorId);
70
71
if
(this.
Parent
is
IActors
Actors
)
72
Actors
.
Register
(this.actor);
73
74
return
base.Initialize();
75
}
76
}
77
}
TAG.Simulator.Model
Root node of a simulation model
Definition:
Model.cs:49
TAG.Simulator.Model.TryGetActor
bool TryGetActor(string Id, out IActor Actor)
Tries to get a registered actor from the model.
Definition:
Model.cs:336
TAG.Simulator.ObjectModel.Actors.Actor
Abstract base class for actors
Definition:
Actor.cs:15
TAG.Simulator.ObjectModel.Actors.Actors
Container for actors.
Definition:
Actors.cs:9
TAG.Simulator.ObjectModel.Actors.Actors.Register
void Register(IActor Actor)
Registers an actor with the collection of actors.
Definition:
Actors.cs:42
TAG.Simulator.ObjectModel.Events.FromPopulation
References a specific population of actors.
Definition:
FromPopulation.cs:13
TAG.Simulator.ObjectModel.Events.FromPopulation.Initialize
override Task Initialize()
Initialized the node before simulation.
Definition:
FromPopulation.cs:66
TAG.Simulator.ObjectModel.Events.FromPopulation.Create
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
Definition:
FromPopulation.cs:48
TAG.Simulator.ObjectModel.Events.FromPopulation.FromXml
override Task FromXml(XmlElement Definition)
Sets properties and attributes of class in accordance with XML definition.
Definition:
FromPopulation.cs:57
TAG.Simulator.ObjectModel.Events.FromPopulation.ActorId
string ActorId
Name of actor defining the population.
Definition:
FromPopulation.cs:35
TAG.Simulator.ObjectModel.Events.FromPopulation.FromPopulation
FromPopulation(ISimulationNode Parent, Model Model)
References a specific population of actors.
Definition:
FromPopulation.cs:22
TAG.Simulator.ObjectModel.Events.FromPopulation.LocalName
override string LocalName
Local name of XML element defining contents of class.
Definition:
FromPopulation.cs:30
TAG.Simulator.ObjectModel.SimulationNode
Abstract base class for simulation nodes
Definition:
SimulationNode.cs:14
TAG.Simulator.ObjectModel.SimulationNode.Parent
ISimulationNode Parent
Parent node in the simulation model.
Definition:
SimulationNode.cs:32
Waher.Content.Xml.XML
Helps with common XML-related tasks.
Definition:
XML.cs:19
Waher.Content.Xml.XML.Attribute
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Definition:
XML.cs:914
TAG.Simulator.ISimulationNode
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
Definition:
ISimulationNode.cs:18
TAG.Simulator.ObjectModel.Actors.IActor
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
Definition:
IActor.cs:11
TAG.Simulator.ObjectModel.Actors.IActors
Interface for collections of actors.
Definition:
IActors.cs:7
TAG.Simulator.ObjectModel.Actors
Definition:
Actor.cs:10
TAG.Simulator.ObjectModel.Events
Definition:
ActorReference.cs:11
Waher.Content.Xml
Definition:
XmlCodec.cs:11
ComSim
TAG.Simulator
ObjectModel
Events
FromPopulation.cs
Generated by
1.9.5