Esempio n. 1
0
        internal static HydraulicCondition Read(this HydraulicConditionElementEntity entity, ReadConversionCollector collector)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }
            if (collector == null)
            {
                throw new ArgumentNullException(nameof(collector));
            }

            if (collector.Contains(entity))
            {
                return(collector.Get(entity));
            }

            FragilityCurveElement curveElement = entity.FragilityCurveElementEntity.Read(collector);
            var condition = new HydraulicCondition
            {
                Probability = curveElement.Probability,
                WaterLevel  = curveElement.WaterLevel,
                WavePeriod  = entity.WavePeriod == null ? double.NaN : (double)entity.WavePeriod,
                WaveHeight  = entity.WaveHeight == null ? double.NaN : (double)entity.WaveHeight
            };

            collector.Collect(entity, condition);
            return(condition);
        }
Esempio n. 2
0
        internal static HydraulicConditionElementEntity Create(this HydraulicCondition model, PersistenceRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

            if (registry.Contains(model))
            {
                return(registry.Get(model));
            }

            var entity = new HydraulicConditionElementEntity
            {
                FragilityCurveElementEntity = ((FragilityCurveElement)model).Create(registry),
                WaveHeight = model.WaveHeight.ToNaNAsNull(),
                WavePeriod = model.WavePeriod.ToNaNAsNull()
            };

            registry.Register(model, entity);

            return(entity);
        }
 internal bool Contains(HydraulicConditionElementEntity entity)
 {
     return(Contains(hydraulicConditions, entity));
 }
 internal void Collect(HydraulicConditionElementEntity entity, HydraulicCondition model)
 {
     Collect(hydraulicConditions, entity, model);
 }
 internal HydraulicCondition Get(HydraulicConditionElementEntity entity)
 {
     return(Get(hydraulicConditions, entity));
 }
Esempio n. 6
0
 internal void Register(HydraulicCondition model, HydraulicConditionElementEntity entity)
 {
     Register(hydraulicConditions, model, entity);
 }