コード例 #1
0
 public void SetUp()
 {
     this.simpleQuantityKind = new SimpleQuantityKind()
     {
         ShortName = "TST", Name = "TEST"
     };
     this.parameter = new Parameter()
     {
         ParameterType = this.simpleQuantityKind
     };
     this.nestedParameter = new NestedParameter()
     {
         AssociatedParameter = this.parameter
     };
 }
        /// <summary>
        /// Serialize the <see cref="NestedParameter"/>
        /// </summary>
        /// <param name="nestedParameter">The <see cref="NestedParameter"/> to serialize</param>
        /// <returns>The <see cref="JObject"/></returns>
        private JObject Serialize(NestedParameter nestedParameter)
        {
            var jsonObject = new JObject();

            jsonObject.Add("actualState", this.PropertySerializerMap["actualState"](nestedParameter.ActualState));
            jsonObject.Add("actualValue", this.PropertySerializerMap["actualValue"](nestedParameter.ActualValue));
            jsonObject.Add("associatedParameter", this.PropertySerializerMap["associatedParameter"](nestedParameter.AssociatedParameter));
            jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), nestedParameter.ClassKind)));
            jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](nestedParameter.ExcludedDomain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](nestedParameter.ExcludedPerson.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("formula", this.PropertySerializerMap["formula"](nestedParameter.Formula));
            jsonObject.Add("iid", this.PropertySerializerMap["iid"](nestedParameter.Iid));
            jsonObject.Add("isVolatile", this.PropertySerializerMap["isVolatile"](nestedParameter.IsVolatile));
            jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](nestedParameter.ModifiedOn));
            jsonObject.Add("owner", this.PropertySerializerMap["owner"](nestedParameter.Owner));
            jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](nestedParameter.RevisionNumber));
            jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](nestedParameter.ThingPreference));
            return(jsonObject);
        }
コード例 #3
0
        /// <summary>
        /// Creates a <see cref="NestedParameter"/> based on the provided <see cref="ParameterOrOverrideBase"/> and <see cref="ParameterValueSetBase"/>
        /// </summary>
        /// <param name="subscription">
        /// The <see cref="ParameterSubscription"/> that contains the <see cref="ParameterSubscriptionValueSet"/> based on which the
        /// <see cref="NestedParameter"/> is created.
        /// </param>
        /// <param name="component">
        /// The <see cref="ParameterTypeComponent"/> that this <see cref="NestedParameter"/> is associated to. This may be null in case the <see cref="ParameterType"/>
        /// of the associated <see cref="Parameter"/> is a <see cref="ScalarParameterType"/>.
        /// </param>
        /// <param name="valueSet">
        /// The <see cref="ParameterSubscriptionValueSet"/> that provides the reference to the <see cref="ActualFiniteState"/> and values
        /// to create the <see cref="NestedParameter"/>
        /// </param>
        /// <param name="option">
        /// The <see cref="Option"/> for which the <see cref="NestedParameter"/> is created.
        /// </param>
        /// <returns>
        /// An instance of a non-volatile <see cref="NestedParameter"/>
        /// </returns>
        private NestedParameter CreateNestedParameter(ParameterSubscription subscription, ParameterTypeComponent component, ParameterSubscriptionValueSet valueSet, Option option)
        {
            var componentIndex = component == null ? 0 : component.Index;
            var actualValue    = valueSet.ActualValue[componentIndex];

            var nestedParameter = new NestedParameter(Guid.NewGuid(), subscription.Cache, subscription.IDalUri)
            {
                IsVolatile          = true,
                AssociatedParameter = subscription,
                Owner       = subscription.Owner,
                Component   = component,
                ActualState = valueSet.ActualState,
                ActualValue = actualValue,
                ValueSet    = valueSet,
                Option      = option
            };

            return(nestedParameter);
        }
コード例 #4
0
        /// <summary>
        /// Creates a <see cref="NestedParameter"/> based on the provided <see cref="ParameterOrOverrideBase"/> and <see cref="ParameterValueSetBase"/>
        /// </summary>
        /// <param name="parameter">
        /// The <see cref="ParameterOrOverrideBase"/> that contains the <see cref="ParameterValueSetBase"/> based on which the
        /// <see cref="NestedParameter"/> is created.
        /// </param>
        /// <param name="component">
        /// The <see cref="ParameterTypeComponent"/> that this <see cref="NestedParameter"/> is associated to. This may be null in case the <see cref="ParameterType"/>
        /// of the associated <see cref="Parameter"/> is a <see cref="ScalarParameterType"/>.
        /// </param>
        /// <param name="valueSet">
        /// The <see cref="ParameterValueSetBase"/> that provides the reference to the <see cref="ActualFiniteState"/> and values
        /// to create the <see cref="NestedParameter"/>
        /// </param>
        /// <param name="option">
        /// The <see cref="Option"/> for which the <see cref="NestedParameter"/> is created.
        /// </param>
        /// <returns>
        /// An instance of a non-volatile <see cref="NestedParameter"/>
        /// </returns>
        private NestedParameter CreatedNestedParameter(ParameterOrOverrideBase parameter, ParameterTypeComponent component, ParameterValueSetBase valueSet, Option option)
        {
            var componentIndex = component == null ? 0 : component.Index;
            var actualValue    = valueSet.ActualValue[componentIndex];
            var formula        = valueSet.Formula[componentIndex];

            var nestedParameter = new NestedParameter(Guid.NewGuid(), parameter.Cache, parameter.IDalUri)
            {
                IsVolatile          = true,
                AssociatedParameter = parameter,
                Owner       = parameter.Owner,
                Component   = component,
                ActualState = valueSet.ActualState,
                ActualValue = actualValue,
                Formula     = formula,
                ValueSet    = valueSet,
                Option      = option
            };

            return(nestedParameter);
        }
コード例 #5
0
 /// <summary>
 /// Add an Nested Parameter row view model to the list of <see cref="NestedParameter"/>
 /// </summary>
 /// <param name="nestedParameter">
 /// The <see cref="NestedParameter"/> that is to be added
 /// </param>
 private NestedParameterRowViewModel AddNestedParameterRowViewModel(NestedParameter nestedParameter)
 {
     return(new NestedParameterRowViewModel(nestedParameter, this.Session, this));
 }