コード例 #1
0
        private StockGroup GetAutoGeneratedStockGroup(StockType t)
        {
            string n = DataTableUtilities.GetAutoGeneratedGroupName(t.Name);

            foreach (StockGroup g in this.m_StockGroups)
            {
                if (g.Name == n)
                {
                    return(g);
                }
            }

            throw new ArgumentException("Auto-generated group not found for stock type: " + t.Name);
        }
コード例 #2
0
        private void RecordSummaryStockOutputData()
        {
            foreach (Cell c in this.STSimTransformer.Cells)
            {
                Dictionary <int, double> StockAmounts = GetStockAmountDictionary(c);

                foreach (int StockTypeId in StockAmounts.Keys)
                {
                    StockType t      = this.m_StockTypes[StockTypeId];
                    double    amount = StockAmounts[StockTypeId];

                    foreach (StockGroupLinkage l in t.StockGroupLinkages)
                    {
                        if (!l.StockGroup.OutputFilter.HasFlag(Constants.OutputFilter.Tabular))
                        {
                            continue;
                        }

                        FiveIntegerLookupKey k = new FiveIntegerLookupKey(
                            c.StratumId, GetSecondaryStratumIdKey(c),
                            GetTertiaryStratumIdKey(c), c.StateClassId, l.StockGroup.Id);

                        if (this.m_SummaryOutputStockRecords.Contains(k))
                        {
                            OutputStock r = this.m_SummaryOutputStockRecords[k];
                            r.Amount += (amount * l.Value);
                        }
                        else
                        {
                            OutputStock r = new OutputStock(
                                c.StratumId, GetSecondaryStratumIdValue(c),
                                GetTertiaryStratumIdValue(c), c.StateClassId, l.StockGroup.Id, amount * l.Value);

                            this.m_SummaryOutputStockRecords.Add(r);
                        }
                    }
                }
            }
        }