2using System.Collections.Generic;
4using System.Threading.Tasks;
17 private readonly List<IActor> actors =
new List<IActor>();
18 private IActor[] actorsStat;
22 private bool exclusive;
42 public string Name => this.name;
64 public override Task
FromXml(XmlElement Definition)
67 this.exclusive =
XML.
Attribute(Definition,
"exclusive",
true);
69 return base.FromXml(Definition);
78 this.actors.Add(
Actor);
86 this.actorsStat = this.actors.ToArray();
87 this.count = this.actorsStat.Length;
88 this.name2 = this.name +
" Actor";
101 int[] P =
new int[this.count];
106 for (i = j = 0; i < this.count; i++)
113 throw new Exception(
"No free individual available in population.");
130 Tags.Add(
new KeyValuePair<string, object>(this.name,
Actor.
InstanceId));
132 return Task.CompletedTask;
141 if (this.exclusive &&
143 v.ValueObject is
IActor InstanceActor &&
148 ActorPopulation.ReturnIndividual(InstanceActor);
167 string s = this.name +
"_" + Index.ToString() +
"_A" + i.ToString();
169 Output.Write(
"actor \"");
170 Output.Write(this.name);
171 Output.Write(
"\" as ");
175 Output.WriteLine(
">>");
180 Output.Write(
" --> UC");
181 Output.Write(Index.ToString());
183 if (!
string.IsNullOrEmpty(
Name))
Root node of a simulation model
int GetRandomInteger(int MaxValueExclusive)
Generates a new random integer between 0 (inclusive) and MaxValueExclusive (exclusive).
Abstract base class for actors
string InstanceId
ID of actor instance.
override string Id
ID of actor.
virtual object ActivityObject
Returns the object that will be used by the actor for actions during an activity.
References a population of actors.
bool Exclusive
If the actor is referenced for exclusive use in the event (i.e. cannot participate in another event a...
string Name
Name of actor within the scope of the event.
override ISimulationNode Create(ISimulationNode Parent, Model Model)
Creates a new instance of the node.
override Task Prepare(Variables Variables, List< KeyValuePair< string, object > > Tags)
Prepares Variables for the execution of an event.
void Register(IActor Actor)
Registers an actor with the collection of actors.
override Task Start()
Starts the node.
override void ExportPlantUml(StreamWriter Output, string Name, int Index)
Exports the node to PlantUML script in a markdown document.
override void Release(Variables Variables)
Releases resources at the end of an event.
ActorReference(ISimulationNode Parent, Model Model)
References a population of actors.
override string LocalName
Local name of XML element defining contents of class.
override Task FromXml(XmlElement Definition)
Sets properties and attributes of class in accordance with XML definition.
Abstract base class for event preparation nodes (with children).
virtual void AnnotateActorUseCaseUml(StreamWriter Output, string Id)
Allows the actor to add notes related to the actor in use case diagrams.
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Contains information about a variable.
virtual bool TryGetVariable(string Name, out Variable Variable)
Tries to get a variable object, given its name.
virtual bool Remove(string VariableName)
Removes a varaiable from the collection.
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
Task Start()
Starts the node.
ISimulationNode Parent
Parent node in the simulation model.
Basic interface for simulator nodes. Implementing this interface allows classes with default contruct...
int FreeCount
Number of individuals in population that are free.
IActor GetFreeIndividual(int Index, bool Exclusive)
Gets a free individual instance from the population.
Interface for collections of actors.