/// <summary>
        /// Mencari index variabel pada list
        /// </summary>
        /// <param name="variableCollection">list variabel</param>
        /// <param name="name">nama variabel</param>
        /// <returns>index</returns>
        public static int FindVariableIndex(SeriesVariables variableCollection, string name)
        {
            variableToFind = new SeriesVariable(name, "");
            System.Predicate <SeriesVariable> search = findVariablePredicate;

            return(variableCollection.FindIndex(search));
        }
Beispiel #2
0
        /// <summary>
        /// Mengkloning objek
        /// </summary>
        /// <returns>objek baru hasil kloning</returns>
        public override object Clone()
        {
            SeriesVariables clone = new SeriesVariables();

            SeriesVariable[] arr = this.ToArray();
            clone.AddRange(arr);
            return(clone);
        }
        /// <summary>
        /// Mencari index variabel pada list
        /// </summary>
        /// <param name="variableCollection">list variabel</param>
        /// <param name="name">nama variabel</param>
        /// <returns>index</returns>
        public static int FindGroupIndex(SeriesGroups groupCollection, string name)
        {
            SeriesVariables a = new SeriesVariables();

            groupToFind = new SeriesGroup(name, a);
            System.Predicate <SeriesGroup> search = findGroupPredicate;

            return(groupCollection.FindIndex(search));
        }
 /// <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);
        }
Beispiel #7
0
        /// <summary>
        /// Membaca data
        /// </summary>
        /// <returns>Series Data hasil pembacaan</returns>
        public SeriesData ReadData()
        {
            SeriesData tmpData;

            seriesDataReader.ReadToFollowing("SeriesData");
            seriesDataReader.ReadStartElement();
            {
                string seriesName = seriesDataReader.ReadElementContentAsString();
                SeriesData.SeriesFrequency freq = (SeriesData.SeriesFrequency)seriesDataReader.ReadElementContentAsInt();
                DateTime startDate = new DateTime();
                DateTime endDate   = new DateTime();
                if (freq != SeriesData.SeriesFrequency.Undated)
                {
                    startDate = XmlConvert.ToDateTime(seriesDataReader.ReadElementContentAsString(), "dd/MM/yyyy");
                    endDate   = XmlConvert.ToDateTime(seriesDataReader.ReadElementContentAsString(), "dd/MM/yyyy");
                }
                else
                {
                    seriesDataReader.Skip();
                    seriesDataReader.Skip();
                }
                int numberObservations = seriesDataReader.ReadElementContentAsInt();

                if (freq != SeriesData.SeriesFrequency.Undated)
                {
                    tmpData = new SeriesData(seriesName, freq, startDate, endDate);
                }
                else
                {
                    tmpData = new SeriesData(seriesName, numberObservations);
                }
            }

            seriesDataReader.ReadStartElement();
            while (seriesDataReader.IsStartElement("SeriesVariable"))
            {
                SeriesVariable tmpVariable;
                seriesDataReader.ReadStartElement();
                {
                    string variableName        = seriesDataReader.ReadElementContentAsString();
                    string variableDescription = seriesDataReader.ReadElementContentAsString();
                    tmpVariable = new SeriesVariable(variableName, variableDescription);
                }
                seriesDataReader.ReadStartElement();
                for (int i = 0; i < tmpData.NumberObservations; i++)
                {
                    tmpVariable.SeriesValues.Add(seriesDataReader.ReadElementContentAsDouble());
                }
                seriesDataReader.ReadEndElement();
                tmpData.SeriesVariables.Add(tmpVariable);
                seriesDataReader.ReadEndElement();
            }

            seriesDataReader.ReadToFollowing("SeriesGroups");
            seriesDataReader.ReadStartElement();
            while (seriesDataReader.IsStartElement("SeriesGroup"))
            {
                SeriesGroup     tmpGroup;
                SeriesVariables tmpGroupList = new SeriesVariables();
                seriesDataReader.ReadStartElement();
                string groupName = seriesDataReader.ReadElementContentAsString();
                seriesDataReader.ReadStartElement();
                while (seriesDataReader.IsStartElement("SeriesVariableItem"))
                {
                    SeriesVariable tmpVariableItem;
                    string         variableName = seriesDataReader.ReadElementContentAsString();
                    tmpVariableItem = tmpData.SeriesVariables[VariableFinder.FindVariableIndex(tmpData.SeriesVariables, variableName)];
                    tmpGroupList.Add(tmpVariableItem);
                }
                tmpGroup = new SeriesGroup(groupName, tmpGroupList);
                seriesDataReader.ReadEndElement();
                tmpData.SeriesGroups.Add(tmpGroup);
                seriesDataReader.ReadEndElement();
            }

            return(tmpData);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="name">nama group</param>
 /// <param name="groupList">list variabel anggota group</param>
 public SeriesGroup(string name, SeriesVariables groupList)
 {
     this.groupName     = name;
     this.groupList     = groupList;
     groupList.Changed += new ChangedEventHandler(groupList_Changed);
 }