本文整理汇总了C#中IAgent.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IAgent.GetType方法的具体用法?C# IAgent.GetType怎么用?C# IAgent.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAgent
的用法示例。
在下文中一共展示了IAgent.GetType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAgent
/** Add a previously removed agent to the simulation.
* An agent can only be in one simulation at a time, any attempt to add an agent to two simulations
* or multiple times to the same simulation will result in an exception being thrown.
*
* \see RemoveAgent
*/
public IAgent AddAgent (IAgent agent) {
if (agent == null) throw new System.ArgumentNullException ("Agent must not be null");
Agent agentReal = agent as Agent;
if (agentReal == null) throw new System.ArgumentException ("The agent must be of type Agent. Agent was of type "+agent.GetType ());
if (agentReal.simulator != null && agentReal.simulator == this) throw new System.ArgumentException ("The agent is already in the simulation");
else if (agentReal.simulator != null) throw new System.ArgumentException ("The agent is already added to another simulation");
agentReal.simulator = this;
//Don't interfere with ongoing calculations
if (Multithreading && doubleBuffering) for (int j=0;j<workers.Length;j++) workers[j].WaitOne();
agents.Add (agentReal);
return agent;
}
示例2: RemoveAgent
/** Removes a specified agent from this simulation.
* The agent can be added again later by using AddAgent.
*
* \see AddAgent(IAgent)
* \see ClearAgents
*/
public void RemoveAgent (IAgent agent) {
if (agent == null) throw new System.ArgumentNullException ("Agent must not be null");
Agent agentReal = agent as Agent;
if (agentReal == null) throw new System.ArgumentException ("The agent must be of type Agent. Agent was of type "+agent.GetType ());
if (agentReal.simulator != this) throw new System.ArgumentException ("The agent is not added to this simulation");
//Don't interfere with ongoing calculations
if (Multithreading && doubleBuffering) for (int j=0;j<workers.Length;j++) workers[j].WaitOne();
agentReal.simulator = null;
if (!agents.Remove (agentReal)) {
throw new System.ArgumentException ("Critical Bug! This should not happen. Please report this.");
}
}
示例3: RemoveAgent
public void RemoveAgent(IAgent agent)
{
if (agent == null)
{
throw new ArgumentNullException("Agent must not be null");
}
Agent agent2 = agent as Agent;
if (agent2 == null)
{
throw new ArgumentException("The agent must be of type Agent. Agent was of type " + agent.GetType());
}
if (agent2.simulator != this)
{
throw new ArgumentException("The agent is not added to this simulation");
}
if (this.Multithreading && this.doubleBuffering)
{
for (int i = 0; i < this.workers.Length; i++)
{
this.workers[i].WaitOne();
}
}
agent2.simulator = null;
if (!this.agents.Remove(agent2))
{
throw new ArgumentException("Critical Bug! This should not happen. Please report this.");
}
}
示例4: AddAgent
public IAgent AddAgent(IAgent agent)
{
if (agent == null)
{
throw new ArgumentNullException("Agent must not be null");
}
Agent agent2 = agent as Agent;
if (agent2 == null)
{
throw new ArgumentException("The agent must be of type Agent. Agent was of type " + agent.GetType());
}
if (agent2.simulator != null && agent2.simulator == this)
{
throw new ArgumentException("The agent is already in the simulation");
}
if (agent2.simulator != null)
{
throw new ArgumentException("The agent is already added to another simulation");
}
agent2.simulator = this;
if (this.Multithreading && this.doubleBuffering)
{
for (int i = 0; i < this.workers.Length; i++)
{
this.workers[i].WaitOne();
}
}
this.agents.Add(agent2);
return agent;
}
示例5: Reload
//[PersistenceConversation(ConversationEndMode = EndMode.CommitAndContinue)]
//public void ManuallyUpdateSchedule()
//{
// TermAlteringListener.Manually();
//}
public void Reload(ref IAgent agent)
{
_timeBoxRepository.Detach(agent.Schedule);
var reloadAgent = _timeBoxRepository.GetAgent(agent.LaborRule, agent.GetType()).TransferPropertiesFrom(agent);
agent = reloadAgent;
}
示例6: AgentInfo
public AgentInfo(IAgent agent) : this() {
this.Type = agent.GetType();
}
示例7: AgentUpdateInfo
public AgentUpdateInfo(IAgent agent) : base(agent) {
this.Type = agent.GetType();this.EffectsPreviousList = new List<AgentEffect>();
}