Пример #1
0
        /// <summary>
        /// Constructs a <see cref="SolutionArray"/> containing the base properties of a variable in a solution file.
        /// </summary>
        /// <param name="variableIndex">
        /// The index number of this variable among all variables. [VCNM, NUMVC].
        /// </param>
        /// <param name="numberOfSets">
        /// The number of sets defined on this array. [VCNI, VCNIND(NUMVC)].
        /// </param>
        /// <param name="name">
        /// The name of the variable. [VCNM, VCNAM(NUMVC)].
        /// </param>
        /// <param name="description">
        /// The variable description. [VCL0, VCLB(NUMVC)].
        /// </param>
        /// <param name="unitType">
        /// The unit type of the variable (e.g. ln, lv = levels var, ol = ORIG_LEV). [VCLE].
        /// </param>
        /// <param name="changeType">
        /// The <see cref="ModelChangeType"/> for this object. [VCT0, VCTP(NUMVC)].
        /// </param>
        /// <param name="variableType">
        /// The <see cref="ModelVariableType"/> for this object. [VCS0, VCSTAT(NUMVC)].
        /// </param>
        /// <param name="sets"></param>
        public SolutionArray(int variableIndex, int numberOfSets, string name, string description, string unitType, ModelChangeType changeType, ModelVariableType variableType, [NotNull] KeyValuePair <string, IImmutableList <string> >[] sets)
        {
            if (name is null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (description is null)
            {
                throw new ArgumentNullException(nameof(description));
            }
            if (unitType is null)
            {
                throw new ArgumentNullException(nameof(unitType));
            }
            if (sets is null)
            {
                throw new ArgumentNullException(nameof(sets));
            }

            Name          = name;
            Description   = description;
            VariableIndex = variableIndex;
            ChangeType    = changeType;
            VariableType  = variableType;
            UnitType      = unitType;
            NumberOfSets  = numberOfSets;
            Sets          = sets;
            Count         = sets.Aggregate(1, (current, next) => current * next.Value.Count);
        }
Пример #2
0
 void FireModelChanged(ModelChangeType t, XmlNode node)
 {
     if (this.ModelChanged != null)
     {
         this.ModelChanged(this, new ModelChangedEventArgs(t, node));
     }
 }
Пример #3
0
 public ModelChangeEvent(PlayerModelTrainingDump stateBefore, PlayerModelTrainingDump stateAfter, ModelChangeType type)
 {
     this.Type        = type;
     this.StateBefore = stateBefore;
     this.StateAfter  = stateAfter;
     UpdateDelta();
 }
 private ModelChangeInfoImpl(ModelChangeType modelChangeType, ModelItem subject, string propertyName, ModelItem key, ModelItem oldValue, ModelItem value)
 {
     this.modelChangeType = modelChangeType;
     this.subject = subject;
     this.propertyName = propertyName;
     this.key = key;
     this.oldValue = oldValue;
     this.value = value;
 }
 private ModelChangeInfoImpl(ModelChangeType modelChangeType, ModelItem subject, string propertyName, ModelItem key, ModelItem oldValue, ModelItem value)
 {
     this.modelChangeType = modelChangeType;
     this.subject         = subject;
     this.propertyName    = propertyName;
     this.key             = key;
     this.oldValue        = oldValue;
     this.value           = value;
 }
        private void OnDocumentChanged(object sender, XmlNodeChangedEventArgs e)
        {
            // initialize t
            ModelChangeType t = ModelChangeType.NodeChanged;

            if (e.Node is XmlProcessingInstruction)
            {
                OnPIChange(e);
            }

            if (XmlHelpers.IsXmlnsNode(e.NewParent) || XmlHelpers.IsXmlnsNode(e.Node))
            {
                // we flag a namespace change whenever an xmlns attribute changes.
                t = ModelChangeType.NamespaceChanged;
                XmlNode node = e.Node;
                if (e.Action == XmlNodeChangedAction.Remove)
                {
                    node = e.OldParent; // since node.OwnerElement link has been severed!
                }
                this.dirty = true;
                FireModelChanged(t, node);
            }
            else
            {
                switch (e.Action)
                {
                case XmlNodeChangedAction.Change:
                    t = ModelChangeType.NodeChanged;
                    break;

                case XmlNodeChangedAction.Insert:
                    t = ModelChangeType.NodeInserted;
                    break;

                case XmlNodeChangedAction.Remove:
                    t = ModelChangeType.NodeRemoved;
                    break;
                }
                this.dirty = true;
                FireModelChanged(t, e.Node);
            }
        }
Пример #7
0
 public ModelChangedEventArgs(ModelChangeType t, XmlNode node)
 {
     this.type = t;
     this.node = node;
 }
Пример #8
0
 void FireModelChanged(ModelChangeType t, XmlNode node)
 {
     if (this.ModelChanged != null)
         this.ModelChanged(this, new ModelChangedEventArgs(t, node));
 }
 public ModelChangedEventArgs(ModelChangeType t, XmlNode node)
 {
     this.type = t;
     this.node = node;
 }
Пример #10
0
 /// <summary>
 /// Create a new ModelChangedEventArgs instance.
 /// </summary>
 /// <param name="changeType">The kind of change to the model.</param>
 /// <param name="changedResources">Resources which are subject to the change.</param>
 public ModelChangedEventArgs(ModelChangeType changeType, IEnumerable <IResource> changedResources) : base()
 {
     ChangeType       = changeType;
     ChangedResources = changedResources;
 }
Пример #11
0
 public GameProxyEvent(ModelChangeEvent cause, PlayerModelTrainingDump stateBefore, PlayerModelTrainingDump stateAfter, ModelChangeType type) :
     base(stateBefore, stateAfter, type)
 {
     this.Cause = cause;
 }
Пример #12
0
 public GameDecizionEvent(TrainingDecisionModel decisionTraining, PlayerModelTrainingDump stateBefore, PlayerModelTrainingDump stateAfter, ModelChangeType type) :
     base(stateBefore, stateAfter, type)
 {
     this.DecisionTraining = decisionTraining;
 }