/// <summary> /// This constuctor is called to construct any ModelElement. /// </summary> /// <param name="parent">A reference to the parent model element.</param> /// <param name="name">The name of the model element.</param> public ModelElementBase(ModelElementBase parent, string name) { ConstructorCalls(name); Parent = parent ?? throw new ArgumentNullException($"Tried to construct ModelElement with name \"{name}\" but the parent ModelElement is null."); parent.AddModelElement(this); MyModel = parent.MyModel; }
/// <summary> /// Changes the parent model element of this model element to the supplied model element. /// </summary> /// <param name="newParent">The parent for this model element.</param> private void ChangeParentModelElement(ModelElementBase newParent) { ModelElementBase oldParent = Parent; if (oldParent != newParent) { oldParent.RemoveModelElement(this); newParent.AddModelElement(this); MyModel = newParent.MyModel; } }
public EventGeneratorBase(ModelElementBase parent, string name, Distribution interEventTimeDistribution) : base(parent, name) { this.interEventTimeDistribution = interEventTimeDistribution; }
public SchedulingElementBase(ModelElementBase parent, string name) : base(parent, name) { }
/// <summary> /// Removes the supplied child model element from this model element. /// </summary> /// <param name="modelElement">The model element to be removed.</param> private void RemoveModelElement(ModelElementBase modelElement) { modelElements.Remove(modelElement); }
/// <summary> /// Adds the supplied model element as a child to this model element. /// </summary> /// <param name="modelElement">The model element to be added.</param> private void AddModelElement(ModelElementBase modelElement) { modelElements.Add(modelElement); }
public RLElementBase(ModelElementBase parent, string name, RLLayerBase reinforcementLearningLayer) : base(parent, name) { this.reinforcementLearningLayer = reinforcementLearningLayer; }