Ejemplo 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);
        }
        internal static FragilityCurveElementEntity Create(this FragilityCurveElement model, PersistenceRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException(nameof(registry));
            }

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

            var entity = new FragilityCurveElementEntity
            {
                Probability = ((double)model.Probability).ToNaNAsNull(),
                WaterLevel  = model.WaterLevel.ToNaNAsNull()
            };

            registry.Register(model, entity);

            return(entity);
        }
        internal static FragilityCurveElement Read(this FragilityCurveElementEntity 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));
            }

            var element =
                new FragilityCurveElement(entity.WaterLevel.ToNullAsNaN(), (Probability)entity.Probability.ToNullAsNaN());

            collector.Collect(entity, element);

            return(element);
        }
 public FragilityCurveElementViewModel(FragilityCurveElement element)
 {
     FragilityCurveElement = element;
 }
 internal void Collect(FragilityCurveElementEntity entity, FragilityCurveElement model)
 {
     Collect(fragilityCurveElements, entity, model);
 }
Ejemplo n.º 6
0
 internal bool Contains(FragilityCurveElement model)
 {
     return(ContainsValue(fragilityCurveElements, model));
 }
Ejemplo n.º 7
0
 internal void Register(FragilityCurveElement model, FragilityCurveElementEntity entity)
 {
     Register(fragilityCurveElements, model, entity);
 }
Ejemplo n.º 8
0
 public FragilityCurveElementEntity Get(FragilityCurveElement model)
 {
     return(Get(fragilityCurveElements, model));
 }