public BabyProducts() { this.unitCountField = new BabyProductsUnitCount(); this.trayTypeField = new List <string>(); this.subjectCharacterField = new List <string>(); this.styleNameField = new List <string>(); this.specificUsesForProductField = new List <string>(); this.specialFeaturesField = new List <string>(); this.sensorTechnologyField = new List <string>(); this.recommendedUsesForProductField = new List <string>(); this.variationDataField = new BabyProductsVariationData(); this.minimumWeightRecommendationField = new PositiveWeightDimension(); this.minimumManufacturerAgeRecommendedField = new OptionalAgeRecommendedDimension(); this.maximumWeightRecommendationField = new PositiveWeightDimension(); this.maximumManufacturerAgeRecommendedField = new OptionalAgeRecommendedDimension(); this.materialTypeFreeField = new List <string>(); this.lithiumBatteryEnergyContentField = new EnergyConsumptionDimension(); this.lifestyleField = new List <string>(); this.displayVolumeField = new VolumeDimension(); this.frequencyResponseField = new FrequencyDimension(); this.chestSizeField = new ClothingSizeDimension(); this.carSeatWeightGroupEUField = new List <CarSeatWeightGroupEUType>(); this.careInstructionsField = new List <string>(); this.batteryPowerField = new BatteryPowerIntegerDimension(); this.batteryChargeTimeField = new TimeDimension(); this.batteryCapacityField = new BatteryPowerDimension(); this.batteryAverageLifeTalkTimeField = new TimeDimension(); this.batteryAverageLifeStandbyField = new BatteryLifeDimension(); this.batteryAverageLifeField = new BatteryLifeDimension(); this.assemblyTimeField = new AssemblyTimeDimension(); }
public PetSuppliesMisc() { this.widthSizeField = new WidthSizeType(); this.weightRecommendationField = new WeightRecommendationType(); this.volumeField = new VolumeDimension(); this.tankSizeField = new VolumeDimension(); this.specialFeaturesField = new List <string>(); this.petTypeField = new List <string>(); this.neckSizeField = new NeckSizeType(); this.maximumPowerField = new PetPowerDimension(); this.materialCompositionField = new List <string>(); this.lightOutputLuminanceField = new LuminancePositiveIntegerDimension(); this.includedComponentsField = new List <string>(); this.healthBenefitsField = new List <string>(); this.heightRecommendationField = new HeightRecommendationType(); this.girthSizeField = new GirthSizeType(); this.externalCertificationField = new List <string>(); this.displayVolumeField = new VolumeDimension(); this.colorSpecificationField = new PetSuppliesMiscColorSpecification(); this.compatibleDevicesField = new List <string>(); this.careInstructionsField = new List <string>(); this.bulbLifeSpanField = new TimeIntegerDimension(); this.batteryPowerField = new BatteryPowerIntegerDimension(); this.batteryChargeTimeField = new TimeDimension(); this.batteryCapacityField = new BatteryPowerDimension(); this.batteryAverageLifeStandbyField = new BatteryLifeDimension(); this.batteryAverageLifeField = new BatteryLifeDimension(); this.allergenInformationField = new List <AllergenInformationType>(); this.variationDataField = new PetSuppliesMiscVariationData(); this.itemPackageQuantityField = "1"; }
public static TimeDimension TimeDimensionInstance(DateTime time) { var instance = new TimeDimension { AmPm = time.ToString("tt", CultureInfo.InvariantCulture), // ReSharper disable once ExceptionNotDocumented Hour12 = Convert.ToInt16(time.ToString("hh")), Hour12LeadingZero = time.ToString("hh"), Hour24 = time.Hour, Hour24LeadingZero = time.ToString("HH"), Minute = time.Minute, MinuteLeadingZero = time.ToString("mm"), RoundToHour = time.RoundToHour(), RoundToMinute = time.RoundToMinute(), RoundToSecond = time.RoundToSecond(), Second = time.Second, SecondLeadingZero = time.ToString("ss"), Time = time, Time12HourMin = time.ToString("h:mm"), Time12HourMinAmPm = time.ToString("h:mm tt"), Time12HourMinSecAmPm = time.ToString("h:mm:ss tt"), Time12HourMinSecMiliAmPm = time.ToString("h:mm:ss.fff tt"), Time24HourMinCivilian = time.ToString("HH:mm"), Time24HourMinSecCivilian = time.ToString("HH:mm:ss"), Time24HourMinSecMiliCivilian = time.ToString("HH:mm:ss.fff"), Time24HourMinMilitary = time.ToString("HHmm"), Time24HourMinSecMilitary = time.ToString("HHmmss"), Time24HourMinSecMiliMilitary = time.ToString("HHmmss.fff"), TimeId = time.TimeId(), }; return(instance); }
/// <summary> /// Returns a term curve. /// This means the discount factor curve for a YieldCurve, /// an fx forward curve for an Fx curve, /// a recovery rate curve for a credit curve. /// A volatility matrix is not handled. /// </summary> /// <returns></returns> public TermCurve GetTermCurve() { // we need to extract the curve. if (Items1 == null) { return(null); } var psv = Items1[0]; var ycv = psv as YieldCurveValuation; if (ycv?.zeroCurve != null) { return(ycv.zeroCurve.rateCurve ?? ycv.discountFactorCurve); } if (psv is FxCurveValuation fxv) { return(fxv.fxForwardCurve); } if (psv is CreditCurveValuation crv) { return(crv.recoveryRateCurve); } //This only works for volatility curves. if (psv is VolatilityMatrix vm) { var points = vm.dataPoints?.point; var termPoints = new List <TermPoint>(); if (points != null && vm.baseDate?.Value is DateTime baseDate) { foreach (var point in points) { var tenor = point.coordinate[0]?.expiration[0]; var period = tenor?.Items[0]; if (period is Period numDaysPeriod) { var newDate = baseDate.AddDays(Convert.ToInt16(numDaysPeriod.periodMultiplier)); var time = new TimeDimension { Items = new object[1] }; time.Items[0] = newDate; var termPoint = new TermPoint { term = time, mid = point.value, midSpecified = true }; termPoints.Add(termPoint); } } } var termCurve = new TermCurve { point = termPoints.ToArray() }; return(termCurve); } return(null); }
/// <summary> /// Parses a time dimension from strings. /// </summary> /// <param name="expiry"></param> /// <returns></returns> public static TimeDimension Create(DateTime expiry) { var pExpiry = expiry; var dimension = new TimeDimension { Items = new object[] { pExpiry } }; return(dimension); }
public ToysAndGames() { this.toyAwardNameField = new List <ToyAwardType>(); this.styleKeywordsField = new List <string>(); this.specialFeaturesField = new List <string>(); this.careInstructionsField = new List <string>(); this.batteryChargeTimeField = new TimeDimension(); this.batteryAverageLifeStandbyField = new TimeDimension(); this.batteryAverageLifeField = new TimeDimension(); }
public LightBulbs() { this.luminousIntensityField = new LuminiousIntensityDimension(); this.lightOutputLuminanceField = new LuminanceDimension(); this.colorTemperatureField = new TemperatureRatingDimension(); this.bulbSpecialFeaturesField = new List <string>(); this.bulbLifeSpanField = new TimeDimension(); this.beamAngleField = new DegreeDimension(); this.variationDataField = new LightBulbsVariationData(); }
public LabSupply() { this.colorMapField = new List <string>(); this.wellVolumeField = new VolumeDimension(); this.waterRemovalCapacityField = new VolumeDimension(); this.volumeToleranceField = new VolumeRateDimension(); this.volumeAccuracyField = new VolumeRateDimension(); this.upperTemperatureRatingField = new TemperatureDimension(); this.tubeCapacityField = new VolumeDimension(); this.timerRangeField = new StringTimeDimension(); this.temperatureUniformityField = new StringTemperatureDimension(); this.temperatureRecoveryField = new TimeDimension(); this.temperatureRangeField = new StringTemperatureDimension(); this.suctionFlowRateField = new VolumeRateDimension(); this.shakingSpeedField = new SpeedDimension(); this.sampleVolumeField = new VolumeRateDimension(); this.reservoirCapacityField = new VolumeDimension(); this.pressureFlowRateField = new VolumeRateDimension(); this.poreSizeField = new VolumeRateDimension(); this.outputCapacityField = new VolumeDimension(); this.operatingPressureField = new PressureDimension(); this.operatingFrequencyField = new FrequencyDimension(); this.minimumWorkingVolumeField = new VolumeAndVolumeRateDimension(); this.minimumStirringSpeedField = new SpeedDimension(); this.minimumSpeedField = new SpeedDimension(); this.minimumSampleVolumeField = new VolumeAndVolumeRateDimension(); this.minimumInletWaterTemperatureField = new TemperatureDimension(); this.minimumEnergyOutputField = new EnergyDimension(); this.minimumDispensingVolumeField = new VolumeRateDimension(); this.maximumWorkingVolumeField = new VolumeAndVolumeRateDimension(); this.maximumTemperatureField = new TemperatureDimension(); this.maximumStirringVolumeField = new VolumeAndVolumeRateDimension(); this.maximumStirringSpeedField = new SpeedDimension(); this.maximumSpeedField = new SpeedDimension(); this.maximumSampleVolumeField = new VolumeRateDimension(); this.maximumRelativeCentrifugalForceField = new ForceDimension(); this.maximumInletPressureField = new PressureDimension(); this.maximumEnergyOutputField = new EnergyDimension(); this.maximumDispensingVolumeField = new VolumeRateDimension(); this.lowerTemperatureRatingField = new TemperatureDimension(); this.itemVolumeField = new VolumeDimension(); this.inletOutsideDimensionsField = new StringLengthDimension(); this.holdingTimeField = new TimeDimension(); this.heatTimeField = new TimeDimension(); this.graduationRangeField = new StringLengthDimension(); this.graduationIntervalField = new GraduationInterval(); this.dropVolumeField = new VolumeDimension(); this.drawVolumeField = new VolumeAndVolumeRateDimension(); this.currentRatingField = new CurrentDimension(); this.coolantConsumptionRateField = new VolumeRateDimension(); this.coolantCapacityField = new VolumeDimension(); this.chamberVolumeField = new VolumeAndVolumeRateDimension(); this.capacityField = new VolumeDimension(); this.variationDataField = new LabSupplyVariationData(); }
public static TermPoint Create(decimal mid, TimeDimension term) { var termPoint = new TermPoint { mid = mid, midSpecified = true, term = term }; return(termPoint); }
public WirelessAccessories() { this.keywordsField = new List <string>(); this.compatiblePhoneModelsField = new List <string>(); this.batteryPowerField = new BatteryPowerIntegerDimension(); this.chargingTimeField = new TimeDimension(); this.standbyTimeField = new TimeDimension(); this.talkTimeField = new TimeDimension(); this.additionalFeaturesField = new List <string>(); this.variationDataField = new WirelessAccessoriesVariationData(); }
public static TermPoint Create(decimal mid, DateTime term) { var termPoint = new TermPoint { mid = mid, midSpecified = true }; var timeDimension = new TimeDimension(); XsdClassesFieldResolver.TimeDimensionSetDate(timeDimension, term); termPoint.term = timeDimension; return(termPoint); }
public static TermPoint Create(decimal mid, TimeDimension term) { var termPoint = new TermPoint { mid = mid, midSpecified = true }; var timeDimension = new TimeDimension { Items = new object[] { term } }; termPoint.term = timeDimension; return(termPoint); }
private static decimal GetValueByExpirationAndStrike(IEnumerable <PricingStructurePoint> dataPoints, TimeDimension expiration, decimal strike) { foreach (var dataPoint in dataPoints) { if ( XmlSerializerHelper.AreEqual(dataPoint.coordinate[0].expiration[0], expiration) && strike == dataPoint.coordinate[0].strike[0] ) { return(dataPoint.value); } } throw new ArgumentException(); }
public LuxuryBeauty() { this.awardsWonField = new List <string>(); this.lithiumBatteryVoltageField = new VoltageDecimalDimension(); this.lithiumBatteryEnergyContentField = new EnergyConsumptionDimension(); this.batteryPowerField = new BatteryPowerIntegerDimension(); this.batteryChargeTimeField = new TimeDimension(); this.batteryAverageLifeField = new TimeDimension(); this.wattageField = new WattageDimension(); this.voltageField = new VoltageDecimalDimension(); this.includedComponentsField = new List <string>(); this.hairTypeField = new List <string>(); this.skinTypeField = new List <string>(); this.sunProtectionField = new SunProtectionDimension(); this.materialTypeField = new List <string>(); this.colorSpecificationField = new LuxuryBeautyColorSpecification(); this.unitCountField = new LuxuryBeautyUnitCount(); this.variationDataField = new LuxuryBeautyVariationData(); }
internal static TermCurve ConstructDiscountFactors(ILogger logger, ICoreCache cache, string nameSpace, TermCurve inputCurve, DateTime baseDate, string currency) { List <DateTime> dates = inputCurve.point.Select(a => (DateTime)a.term.Items[0]).ToList(); List <decimal> values = inputCurve.point.Select(a => a.mid).ToList(); var properties = new NamedValueSet(); properties.Set(CurveProp.PricingStructureType, PricingStructureTypeEnum.RateCurve.ToString()); properties.Set(CurveProp.Market, "ConstructDiscountFactors"); properties.Set(CurveProp.IndexTenor, "0M"); properties.Set(CurveProp.Currency1, currency); properties.Set(CurveProp.IndexName, "XXX-XXX"); properties.Set(CurveProp.Algorithm, "FastLinearZero"); properties.Set(CurveProp.BaseDate, baseDate); var curveId = new RateCurveIdentifier(properties); var algorithmHolder = new PricingStructureAlgorithmsHolder(logger, cache, nameSpace, curveId.PricingStructureType, curveId.Algorithm); var curve = new RateCurve(properties, algorithmHolder, dates, values); var termPoints = new List <TermPoint>(); for (DateTime date = dates.First(); date <= dates.Last(); date = date.AddMonths(1)) { var discountFactor = (decimal)curve.GetDiscountFactor(date); var timeDimension = new TimeDimension(); XsdClassesFieldResolver.TimeDimensionSetDate(timeDimension, date); var termPoint = new TermPoint { mid = discountFactor, midSpecified = true, term = timeDimension }; termPoints.Add(termPoint); } var termCurve = new TermCurve { point = termPoints.ToArray() }; return(termCurve); }
private static TimeDimension CreateTimeDimension() { var timeDimension = new TimeDimension("Time", TimeDimension.TimeGranularity.Seconds); var primaryColumn = new StarColumn(1, "SurKey", new DataType(OleDbType.Integer), StarColumnType.Key | StarColumnType.SurrogateKey); timeDimension.Constraints.PrimaryKey.Columns.Add(primaryColumn); timeDimension.Constraints.NotNullables.Add(new StarModelComponents.NotNullable(primaryColumn)); var hourColumn = new StarColumn(2, "Hour", new DataType(OleDbType.SmallInt), StarColumnType.DescriptiveMeasure); var minuteColumn = new StarColumn(3, "Minute", new DataType(OleDbType.SmallInt), StarColumnType.DescriptiveMeasure); var secondColumn = new StarColumn(4, "Second", new DataType(OleDbType.SmallInt), StarColumnType.DescriptiveMeasure); timeDimension.Columns.Add(primaryColumn); // Surkey timeDimension.Columns.Add(hourColumn); // Hour timeDimension.Columns.Add(minuteColumn); // Minute timeDimension.Columns.Add(secondColumn); // Second primaryColumn.TableRef = timeDimension; hourColumn.TableRef = timeDimension; minuteColumn.TableRef = timeDimension; secondColumn.TableRef = timeDimension; return(timeDimension); }
static DomainHelperForSpecs() { TimeDimension.AddUnit(new Unit("seconds", 1 / 60.0, 0.0)); AmountDimension.AddUnit(new Unit("mmol", 1000.0, 0.0)); }
public StarModel Refine(StarModel starModel) { var factTable = starModel.FactTable; // If any date/time dimension already exists if (starModel.Dimensions.Any(d => d.Name.Contains("time") || d.Name.Contains("date"))) { return(starModel); } // Create date and time dimension for model. These are also used for roleplaying DateDimension actualDateDimension = CreateDateDimension(); TimeDimension actualTimeDimension = CreateTimeDimension(); // These can either be the actual dimension or roleplaying dimensions DateDimension dateDimension = null; TimeDimension timeDimension = null; // Add a date and/or time dimension to all columns that can express date or time foreach (var temporalColumn in factTable.Columns.Where(c => c.DataType.IsTemporal()).ToList()) { // If date, only add date dimension, likewise with time. If a date/time dimension is already in use, // then use that for roleplaying switch (temporalColumn.DataType.Type) { case OleDbType.DBTime: timeDimension = timeDimension != null ? new TimeDimension(actualTimeDimension) : actualTimeDimension; break; case OleDbType.Date: case OleDbType.DBDate: dateDimension = dateDimension != null ? new DateDimension(actualDateDimension) : actualDateDimension; break; case OleDbType.DBTimeStamp: dateDimension = dateDimension != null ? new DateDimension(actualDateDimension) : actualDateDimension; timeDimension = timeDimension != null ? new TimeDimension(actualTimeDimension) : actualTimeDimension; break; } // If time dimension is set, then add it to the model and add a relation if (timeDimension != null) { starModel.Dimensions.Add(timeDimension); var timeForeignKey = new StarColumn(factTable.Columns.Count + 1, $"{temporalColumn.Name}_Time_Key", new DataType(OleDbType.Integer), StarColumnType.Key); timeForeignKey.ColumnRef = temporalColumn.ColumnRef; var relation = new StarRelation(timeDimension, factTable, new List <StarColumn> { timeDimension.Columns[0] }, new List <StarColumn> { timeForeignKey }, Cardinality.ManyToOne); factTable.Relations.Add(relation); timeDimension.Relations.Add(relation); factTable.Columns.Add(timeForeignKey); factTable.Constraints.PrimaryKey.Columns.Add(timeForeignKey); } // If date dimension is set, then add it to the model and add a relation if (dateDimension != null) { starModel.Dimensions.Add(dateDimension); var dateForeignKey = new StarColumn(factTable.Columns.Count + 1, $"{temporalColumn.Name}_Date_Key", new DataType(OleDbType.Integer), StarColumnType.Key); dateForeignKey.ColumnRef = temporalColumn.ColumnRef; var relation = new StarRelation(dateDimension, factTable, new List <StarColumn> { dateDimension.Columns[0] }, new List <StarColumn> { dateForeignKey }, Cardinality.ManyToOne); factTable.Relations.Add(relation); dateDimension.Relations.Add(relation); factTable.Columns.Add(dateForeignKey); factTable.Constraints.PrimaryKey.Columns.Add(dateForeignKey); } temporalColumn.ColumnType = StarColumnType.DescriptiveMeasure; // Cleanup factTable.Columns.Remove(temporalColumn); } return(starModel); }
public static void TimeDimensionSetDate(TimeDimension timeDimension, DateTime value) { timeDimension.Items = new object[] { value }; }
public static DateTime TimeDimensionGetDate(TimeDimension timeDimension) { return((DateTime)timeDimension.Items[0]); }
public void INETimeDimensionToDimensionTest() { TimeDimension ineDimension = new TimeDimension { Code = "1", Abbreviation = "D1", Designation = "Dimension 1", Periods = new List<Period> { new Period { Code = "1", Designation="Designation 1" }, new Period { Code = "2", Designation="Designation 2" }, new Period { Code = "3", Designation="Designation 3" } } }; ProviderDataContracts.Metadata.Dimension expected = new ProviderDataContracts.Metadata.Dimension { ID = "1", Name = "Dimension 1", NameAbbr = "D1", DimensionType = DimensionType.Temporal, Attributes = new List<DimensionAttribute> { new DimensionAttribute { ID = "1", Name = "Designation 1" }, new DimensionAttribute { ID = "2", Name = "Designation 2" }, new DimensionAttribute { ID = "3", Name = "Designation 3" } } }; ProviderDataContracts.Metadata.Dimension actual = DimensionExtension.ToDimension(ineDimension); Assert.AreEqual(expected, actual); }
/// <summary> /// Create a script, that generates all seconds between 00:00 and 23:59 /// </summary> /// <param name="dimension"></param> /// <returns>Script to populate dimension</returns> private string GenerateInsert(TimeDimension dimension) { return(GenerateTimeDimension()); }
/// <summary> /// Create a join condition between a datetime and a time dimension /// </summary> /// <param name="timestampColumn">Datetime column</param> /// <param name="timeDimension">Time dimension</param> /// <returns>Join condition</returns> public string GenerateTimeDimensionJoin(Column timestampColumn, TimeDimension timeDimension) { return($"DATEPART(HOUR, {timestampColumn.GetNameWithAlias()}) = {timeDimension.Columns.First(c => c.Name == "Hour").GetNameWithAlias(timeDimension)} AND " + $"DATEPART(MINUTE, {timestampColumn.GetNameWithAlias()}) = {timeDimension.Columns.First(c => c.Name == "Minute").GetNameWithAlias(timeDimension)} AND " + $"DATEPART(SECOND, {timestampColumn.GetNameWithAlias()}) = {timeDimension.Columns.First(c => c.Name == "Second").GetNameWithAlias(timeDimension)}"); }
} public FoodServiceAndJanSanProductTypeFoodServiceAndJanSan() { this.wideEndDiameterField = new LengthDimension(); this.waterRemovalCapacityField = new VolumeDimension(); this.upperTemperatureRatingField = new TemperatureDimension(); this.timerRangeField = new TimeDimension(); this.temperatureRecoveryField = new TimeDimension(); this.temperatureRangeField = new TemperatureDimension(); this.suctionFlowRateField = new VolumeRateDimension(); this.stemOutsideDiameterField = new LengthDimension(); this.shakingSpeedField = new SpeedDimension(); this.pressureFlowRateField = new VolumeRateDimension(); this.poreSizeField = new VolumeRateDimension(); this.outsideDiameterField = new LengthDimension(); this.outputCapacityField = new VolumeDimension(); this.operatingPressureField = new PressureDimension(); this.neckDiameterField = new LengthDimension(); this.narrowEndDiameterField = new LengthDimension(); this.minimumStirringSpeedField = new SpeedDimension(); this.minimumSpeedField = new SpeedDimension(); this.minimumInletWaterTemperatureField = new TemperatureDimension(); this.minimumDispensingVolumeField = new VolumeRateDimension(); this.maximumWorkingVolumeField = new VolumeAndVolumeRateDimension(); this.maximumTemperatureField = new TemperatureDimension(); this.maximumStirringVolumeField = new VolumeAndVolumeRateDimension(); this.maximumStirringSpeedField = new SpeedDimension(); this.maximumSpeedField = new SpeedDimension(); this.maximumInletPressureField = new PressureDimension(); this.maximumDispensingVolumeField = new VolumeRateDimension(); this.lowerTemperatureRatingField = new TemperatureDimension(); this.itemVolumeField = new VolumeDimension(); this.itemThicknessField = new LengthDimension(); this.itemDiameterField = new LengthDimension(); this.itemDepthField = new LengthDimension(); this.insideWidthField = new LengthDimension(); this.insideLengthField = new LengthDimension(); this.insideHeightField = new LengthDimension(); this.insideDiameterField = new LengthDimension(); this.insideDepthField = new LengthDimension(); this.inletOutsideDimensionsField = new LengthDimension(); this.holdingTimeField = new TimeDimension(); this.heatTimeField = new TimeDimension(); this.graduationRangeField = new LengthDimension(); this.graduationIntervalField = new GraduationInterval(); this.extensionLengthField = new LengthDimension(); this.dropVolumeField = new VolumeDimension(); this.drawVolumeField = new VolumeAndVolumeRateDimension(); this.currentRatingField = new CurrentDimension(); this.coolantConsumptionRateField = new VolumeRateDimension(); this.coolantCapacityField = new VolumeDimension(); this.closureDiameterField = new LengthDimension(); this.capSizeField = new LengthDimension(); this.capacityField = new VolumeWeightDimension(); }
public void Init() { instance = new TimeDimension(); }
private double timeValueInDisplayUnit(double timeValueInBaseUnit) { return(TimeDimension.BaseUnitValueToUnitValue(TimeUnit, timeValueInBaseUnit)); }