/// <summary> /// Constructor /// </summary> /// <param name="name">nama project</param> /// <param name="frequency">frekuensi</param> /// <param name="start">tangal awal</param> /// <param name="end">tangal akhir</param> public SeriesData(string name,SeriesFrequency frequency, DateTime start, DateTime end) { this.seriesName = name; this.frequency = frequency; this.startDate = start; this.endDate = end; this.computeNumberObservations(); this.createNewTimeData(); this.seriesVariables = new SeriesVariables(); this.seriesGroups = new SeriesGroups(); }
/// <summary> /// Constructor /// </summary> /// <param name="name">nama project</param> /// <param name="frequency">frekuensi</param> /// <param name="start">tangal awal</param> /// <param name="end">tangal akhir</param> public SeriesData(string name, SeriesFrequency frequency, DateTime start, DateTime end) { this.seriesName = name; this.frequency = frequency; this.startDate = start; this.endDate = end; this.computeNumberObservations(); this.createNewTimeData(); this.seriesVariables = new SeriesVariables(); this.seriesGroups = new SeriesGroups(); }
/// <summary> /// Constructor. untuk undated /// </summary> /// <param name="name">nama project</param> /// <param name="numberObservations">jumlah observasi</param> public SeriesData(string name, int numberObservations) { this.seriesName = name; this.frequency = SeriesData.SeriesFrequency.Undated; this.numberObservations = numberObservations; this.createNewTimeData(); this.seriesVariables = new SeriesVariables(); this.seriesGroups = new SeriesGroups(); this.seriesVariables.Changed += new ChangedEventHandler(OnChanged); this.seriesGroups.Changed += new ChangedEventHandler(OnChanged); this.time.Changed += new ChangedEventHandler(OnChanged); }
/// <summary> /// Constructor /// </summary> /// <param name="name">nama project</param> /// <param name="frequency">frekuensi</param> /// <param name="start">tangal awal</param> /// <param name="end">tangal akhir</param> public SeriesData(string name, SeriesFrequency frequency, DateTime start, DateTime end) { this.seriesName = name; this.frequency = frequency; this.startDate = start; this.endDate = end; this.computeNumberObservations(); this.createNewTimeData(); this.seriesVariables = new SeriesVariables(); this.seriesGroups = new SeriesGroups(); this.seriesStocks = new SeriesStocks(); this.seriesVariables.Changed += new ChangedEventHandler(OnChanged); this.seriesGroups.Changed += new ChangedEventHandler(OnChanged); this.seriesStocks.Changed += new ChangedEventHandler(OnChanged); this.time.Changed += new ChangedEventHandler(OnChanged); }
/// <summary> /// Constructor /// </summary> /// <param name="name">nama project</param> /// <param name="frequency">frekuensi</param> /// <param name="start">tangal awal</param> /// <param name="end">tangal akhir</param> public SeriesData(string name,SeriesFrequency frequency, DateTime start, DateTime end) { this.seriesName = name; this.frequency = frequency; this.startDate = start; this.endDate = end; this.computeNumberObservations(); this.createNewTimeData(); this.seriesVariables = new SeriesVariables(); this.seriesGroups = new SeriesGroups(); this.seriesStocks = new SeriesStocks(); this.seriesVariables.Changed += new ChangedEventHandler(OnChanged); this.seriesGroups.Changed += new ChangedEventHandler(OnChanged); this.seriesStocks.Changed += new ChangedEventHandler(OnChanged); this.time.Changed += new ChangedEventHandler(OnChanged); }
/// <summary> /// Fungsi statik menghitung jumlah observasi /// </summary> /// <param name="startDate">tanggal awal</param> /// <param name="endDate">tangal akhir</param> /// <param name="frequency">frekuensi</param> /// <returns>jumlah observasi</returns> public static int NumberObservation(DateTime startDate, DateTime endDate, SeriesFrequency frequency) { int intdiff = 0; TimeSpan timediff = new TimeSpan(); DateTime current; switch (frequency) { case SeriesFrequency.Annual: intdiff = endDate.Year - startDate.Year + 1; break; case SeriesFrequency.SemiAnnual: current = startDate; while (current <= endDate) { intdiff++; current = current.AddMonths(6); } break; case SeriesFrequency.Quarterly: current = startDate; while (current <= endDate) { intdiff++; current = current.AddMonths(3); } break; case SeriesFrequency.Monthly: intdiff = 12 * (endDate.Year - startDate.Year) + (endDate.Month - startDate.Month) + 1; break; case SeriesFrequency.Weekly: timediff = endDate - startDate; intdiff = (timediff.Days) / 7 + 1; break; case SeriesFrequency.Daily: timediff = endDate - startDate; intdiff = timediff.Days + 1; break; case SeriesFrequency.Daily6: current = startDate; while (current <= endDate) { if (current.DayOfWeek != DayOfWeek.Sunday) { intdiff++; } current = current.AddDays(1); } break; case SeriesFrequency.Daily5: current = startDate; while (current <= endDate) { if (current.DayOfWeek != DayOfWeek.Sunday && current.DayOfWeek != DayOfWeek.Saturday) { intdiff++; } current = current.AddDays(1); } break; case SeriesFrequency.Undated: break; } return(intdiff); }
/// <summary> /// Fungsi statik menghitung jumlah observasi /// </summary> /// <param name="startDate">tanggal awal</param> /// <param name="endDate">tangal akhir</param> /// <param name="frequency">frekuensi</param> /// <returns>jumlah observasi</returns> public static int NumberObservation(DateTime startDate, DateTime endDate, SeriesFrequency frequency) { int intdiff = 0; TimeSpan timediff = new TimeSpan(); DateTime current; switch (frequency) { case SeriesFrequency.Annual: intdiff = endDate.Year - startDate.Year + 1; break; case SeriesFrequency.SemiAnnual: current = startDate; while (current <= endDate) { intdiff++; current = current.AddMonths(6); } break; case SeriesFrequency.Quarterly: current = startDate; while (current <= endDate) { intdiff++; current = current.AddMonths(3); } break; case SeriesFrequency.Monthly: intdiff = 12 * (endDate.Year - startDate.Year) + (endDate.Month - startDate.Month) + 1; break; case SeriesFrequency.Weekly: timediff = endDate - startDate; intdiff = (timediff.Days) / 7 + 1; break; case SeriesFrequency.Daily: timediff = endDate - startDate; intdiff = timediff.Days + 1; break; case SeriesFrequency.Daily6: current = startDate; while (current <= endDate) { if (current.DayOfWeek != DayOfWeek.Sunday) { intdiff++; } current = current.AddDays(1); } break; case SeriesFrequency.Daily5: current = startDate; while (current <= endDate) { if (current.DayOfWeek != DayOfWeek.Sunday && current.DayOfWeek != DayOfWeek.Saturday) { intdiff++; } current = current.AddDays(1); } break; case SeriesFrequency.Undated: break; } return intdiff; }