示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Weekly" /> class
 /// </summary>
 public Weekly()
     : base(TimeFormatEnumType.Week)
 {
     this._gesmesPeriod = new GesmesPeriod(this)
                         {
                             DateFormat = EdiTimeFormat.Week, PeriodFormat = "0", PeriodMax = NumberOfPeriods + 1 
                         };
 }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Annual"/> class.
 /// </summary>
 public Annual()
     : base(TimeFormatEnumType.Year)
 {
     this._gesmesPeriod = new GesmesPeriod(this)
     {
         DateFormat = EdiTimeFormat.Year, 
         RangeFormat = EdiTimeFormat.RangeYear, 
         PeriodFormat = string.Empty, 
         PeriodMax = NumberOfPeriods
     };
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Semester" /> class
 /// </summary>
 public Semester()
     : base(TimeFormatEnumType.HalfOfYear)
 {
     _gesmesPeriod = new GesmesPeriod(this)
     {
         DateFormat = EdiTimeFormat.HalfOfYear,
         RangeFormat = EdiTimeFormat.RangeHalfOfYear,
         PeriodFormat = "0",
         PeriodMax = 2
     };
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Monthly"/> class.
 /// </summary>
 public Monthly()
     : base(TimeFormatEnumType.Month)
 {
     this._gesmesPeriod = new GesmesPeriod(this)
                         {
                             DateFormat = EdiTimeFormat.Month, 
                             RangeFormat = EdiTimeFormat.RangeMonthly, 
                             PeriodFormat = SdmxFormat, 
                             PeriodMax = NumberOfPeriods
                         };
 }
示例#5
0
 /// <summary>
 /// Prevents a default instance of the <see cref="Hourly" /> class from being created.
 /// </summary>
 public Hourly()
     : base(TimeFormatEnumType.Hour)
 {
     this._gesmesPeriod = new GesmesPeriod(this)
                         {
                             DateFormat = EdiTimeFormat.MinuteFourDigYear,
                             RangeFormat = EdiTimeFormat.None,
                             PeriodFormat = SdmxFormat,
                             PeriodMax = 31 // TODO
                         };
 }
示例#6
0
 /// <summary>
 /// Prevents a default instance of the <see cref="Daily" /> class from being created. 
 /// Initialize a new instance of the <see cref="Daily" /> class
 /// </summary>
 public Daily()
     : base(TimeFormatEnumType.Date)
 {
     this._gesmesPeriod = new GesmesPeriod(this)
                         {
                             DateFormat = EdiTimeFormat.DailyFourDigYear, 
                             RangeFormat = EdiTimeFormat.RangeDaily, 
                             PeriodFormat = SdmxFormat, 
                             PeriodMax = 31
                         };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Quarterly" /> class
 /// </summary>
 public Quarterly()
     : base(TimeFormatEnumType.QuarterOfYear)
 {
     this._gesmesPeriod = new GesmesPeriod(this)
                         {
                             DateFormat = EdiTimeFormat.QuarterOfYear, 
                             RangeFormat = EdiTimeFormat.RangeQuarterOfYear, 
                             PeriodFormat = "0", 
                             PeriodMax = 4
                         };
 }
示例#8
0
 /// <summary>
 /// Prevents a default instance of the <see cref="TriAnnual" /> class from being created. 
 /// Initialize a new instance of the <see cref="TriAnnual" /> class
 /// </summary>
 public TriAnnual()
     : base(TimeFormatEnumType.ThirdOfYear)
 {
     this._noGesmes = new GesmesPeriod(this);
 }
        /// <summary>
        /// Streams the dimensions and observation to ARR series segment
        /// </summary>
        /// <param name="gesmesWriter">
        /// The GESMES Writer.
        /// </param>
        /// <param name="gesmes">
        /// The GESMES period 
        /// </param>
        public void StreamToGesmesTimeRange(TextWriter gesmesWriter, GesmesPeriod gesmes)
        {
            if (this._observations.Count == 0)
            {
                throw new InvalidOperationException(
                    " PushObservation must be used to add observations to ToTimeRangeArray");
            }

            this.WriteArrKeys(gesmesWriter);
            this._observations.Sort(
                (observation, observation1) => observation.TimePeriodValue.CompareTo(observation1.TimePeriodValue));

            string minTimePeriod = this._observations[0].TimePeriod;
            string maxTimePeriod = this._observations[this._observations.Count - 1].TimePeriod;

            gesmesWriter.Write(minTimePeriod);
            gesmesWriter.Write(maxTimePeriod);

            gesmesWriter.Write(_separatorColon);

            gesmesWriter.Write(this.TimeFormatRange);

            string plusSeparator = EdiConstants.Plus.ToString(CultureInfo.InvariantCulture);
            string prefixSeparator = EdiConstants.Colon.ToString(CultureInfo.InvariantCulture);
            int lastperiod = this._observations[0].TimePeriodValue;

            for (int i = 0; i < this._observations.Count; i++)
            {
                GesmesObservation observation = this._observations[i];
                int diff = gesmes.Diff(observation.TimePeriodValue, lastperiod);
                if (diff > 1)
                {
                    gesmesWriter.Write(new string(EdiConstants.Plus[0], diff - 1));
                }

                lastperiod = observation.TimePeriodValue;
                observation.StreamToGesmes(gesmesWriter, prefixSeparator);
                prefixSeparator = plusSeparator;
            }

            gesmesWriter.WriteLine(EdiConstants.EndTag);
        }