Exemple #1
0
        public GekkoTime GetDate(O.GetDateChoices c)
        {
            GekkoTime gt       = Globals.tNull;
            int       intValue = O.GetInt(this);       //will issue error if the VAL is not an integer
            int       year     = G.findYear(intValue); //error is the year is crazy

            if (c == O.GetDateChoices.Strict || (c != O.GetDateChoices.Strict && (Program.options.freq == EFreq.Annual || Program.options.freq == EFreq.Undated)))
            {
                if (Program.options.freq == EFreq.Undated)
                {
                    gt = new GekkoTime(EFreq.Undated, year, 1); //here, the context matters!
                }
                else
                {
                    gt = new GekkoTime(EFreq.Annual, year, 1);  //for a, q, m
                    //so date d = 2000 in freq=m will not turn this into 2000m1 or 2000m12
                }
            }
            else
            {
                //that is, FlexibleStart or FlexibleEnd
                //For Annual and Undated, this has been handled above
                //typically for TIME 2000 2010 or SERIES<2000 2010> which are turned into
                //for instance 2000m1 to 2000m12.
                if (Program.options.freq == EFreq.Quarterly)
                {
                    int sub = 1;
                    if (c == O.GetDateChoices.FlexibleStart)
                    {
                        sub = 1;
                    }
                    else if (c == O.GetDateChoices.FlexibleEnd)
                    {
                        sub = 4;
                    }
                    gt = new GekkoTime(EFreq.Quarterly, year, sub);
                }
                else if (Program.options.freq == EFreq.Monthly)
                {
                    int sub = 1;
                    if (c == O.GetDateChoices.FlexibleStart)
                    {
                        sub = 1;
                    }
                    else if (c == O.GetDateChoices.FlexibleEnd)
                    {
                        sub = 12;
                    }
                    gt = new GekkoTime(EFreq.Monthly, year, sub);
                }
            }
            return(gt);
        }
 public GekkoTime GetDate(O.GetDateChoices c)
 {
     G.Writeln2("*** ERROR: Could not convert the STRING " + this._string2 + " directly into a DATE.");
     G.Writeln("           You may try the date() conversion function.");
     throw new GekkoException();
 }
Exemple #3
0
 public GekkoTime GetDate(O.GetDateChoices c)
 {
     G.Writeln2("*** ERROR: Type mismatch: you are trying to extract a DATE from a list.");
     throw new GekkoException();
 }
 public GekkoTime GetDate(O.GetDateChoices c)
 {
     G.Writeln2("*** ERROR: You are trying to extract a DATE from a timeseries: " + this.ts.variableName + ".");
     throw new GekkoException();
 }
Exemple #5
0
 public GekkoTime GetDate(O.GetDateChoices c)
 {
     //If the input is a date, the raw date is always returned here
     return(this.date);
 }