public IVariable Indexer(GekkoTime t, bool isLhs, params IVariable[] indexes) { if (indexes.Length == 1) { IVariable index = indexes[0]; IVariable rv = null; if (this._string2 == Globals.indexerAloneCheatString) { //corresponds to empty indexer like ['fy*'], different from #a['fy*'] if (index.Type() == EVariableType.String) { //string vars = null; ExtractBankAndRestHelper h = Program.ExtractBankAndRest(((ScalarString)index)._string2, EExtrackBankAndRest.GetDatabank); List <string> output = Program.MatchWildcardInDatabank(h.name, h.databank); rv = new MetaList(output); } else { G.Writeln2("*** ERROR: The inside of a free-standing [...] list should not be a"); G.Writeln(" VAL, DATE or the like, for instance PRT [2.3] or PRT [2010q5]."); G.Writeln(" The right use is PRT [gd*] and similar."); throw new GekkoException(); } } else if (this._isName) { //#8932074324 //TODO: What about string 'jul05:fy' ?????? IVariable result = O.GetValFromStringIndexer(this._string2, index, 1, t); rv = result; } else { G.Writeln2("*** ERROR: You cannot use indexer on a string, for instance %s[2],"); G.Writeln(" but you may use the string as a name instead: {%s}[2015]."); throw new GekkoException(); } return(rv); } else { G.Writeln2("*** ERROR: Cannot use " + indexes.Length + "-dimensional indexer on STRING or NAME"); throw new GekkoException(); } }
public IVariable Indexer(IVariablesFilterRange indexRange, GekkoTime t) { if (this._string2 == Globals.indexerAloneCheatString) { //corresponds to empty index range like ['fx'..'fy'], different from #a['fx'..'fy'] IVariable iv1 = indexRange.first; IVariable iv2 = indexRange.last; string s1 = O.GetString(iv1); string s2 = O.GetString(iv2); ExtractBankAndRestHelper h = Program.ExtractBankAndRest(s1, EExtrackBankAndRest.GetDatabank); List <string> temp = Program.MatchRangeInDatabank(h.name, s2, h.databank); return(new MetaList(temp)); } else { G.Writeln2("*** ERROR: You cannot use []-index on string"); throw new GekkoException(); } }