コード例 #1
0
        public Dictionary<string, object> GetInUseElementDictionary( IEnumerable<CommandIterator> iteratorHierarchy, CommandIterator currentIterator )
        {
            //based on the iteratorType, this may affect the sorting
            Dictionary<string, object> elementDictionary = new Dictionary<string, object>();

            foreach( InstanceReportRow row in this.Rows )
            {
                if( string.IsNullOrEmpty( row.ElementName ) )
                    continue;

                if( !this.IsEquityReport && row.IsAbstractGroupTitle )
                    continue;

                if( elementDictionary.ContainsKey( row.ElementKey ) )
                    continue;

                for( int c = 0; c < this.Columns.Count; c++ )
                {
                    if( this.Columns[ c ].ContainsSegmentMembers( iteratorHierarchy ) )
                    {
                        InstanceReportRow tmpRow = (InstanceReportRow)row.Clone( false, false );
                        elementDictionary[ row.ElementKey ] = tmpRow;
                        break;
                    }
                }
            }

            return elementDictionary;
        }
コード例 #2
0
            public void TestParseSimpleInstruction()
            {
                String      instruction = @"<div style=""display:none;"">~ http://r/role/RiskReturnDetail column period compact * row dei_LegalEntityAxis compact * row rr_ProspectusShareClassAxis compact * row primary compact * ~</div>";
                EmbedReport thisReport  = EmbedReport.LoadAndParse(instruction);

                Assert.AreEqual(1, thisReport.ColumnIterators.Length);
                CommandIterator thisIterator = thisReport.ColumnIterators[0] as CommandIterator;

                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsTrue(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);

                Assert.AreEqual(3, thisReport.RowIterators.Length);
                thisIterator = thisReport.RowIterators[0] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);
                Assert.IsTrue(thisIterator.AxisName == "dei_LegalEntityAxis");
                thisIterator = thisReport.RowIterators[1] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);
                Assert.IsTrue(thisIterator.AxisName == "rr_ProspectusShareClassAxis");
                thisIterator = thisReport.RowIterators[2] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);
                Assert.IsTrue(thisIterator.Filter == "*");

                Assert.AreEqual(@"http://r/role/RiskReturnDetail", thisReport.Role);
                Assert.IsFalse(thisReport.IsTransposed);
            }
コード例 #3
0
            public void TestParseComplexInstruction()
            {
                String      instruction = @"~ http://europa.eu/role/R4041 column primary compact * row us-gaap_DerivativeByNatureAxis grouped * row us-gaap_InvestmentSecondaryCategorizationAxis grouped * row invest_InvestmentAxis unitcell * ~";
                EmbedReport thisReport  = EmbedReport.LoadAndParse(instruction);

                Assert.AreEqual(2, thisReport.ColumnIterators.Length);

                CommandIterator thisIterator = thisReport.ColumnIterators[0] as CommandIterator;

                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsTrue(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Filter == "*");
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);

                thisIterator = thisReport.ColumnIterators[1] as CommandIterator;
                Assert.IsTrue(thisIterator.IsCompact);
                Assert.IsTrue(thisIterator.IsPrimary);
                Assert.IsTrue(thisIterator.Filter == "*");
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Compact);

                Assert.AreEqual(3, thisReport.RowIterators.Length);
                thisIterator = thisReport.RowIterators[0] as CommandIterator;
                Assert.IsFalse(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Grouped);
                Assert.IsTrue(thisIterator.AxisName == "us-gaap_DerivativeByNatureAxis");
                thisIterator = thisReport.RowIterators[1] as CommandIterator;
                Assert.IsFalse(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.Grouped);
                Assert.IsTrue(thisIterator.AxisName == "us-gaap_InvestmentSecondaryCategorizationAxis");
                thisIterator = thisReport.RowIterators[2] as CommandIterator;
                Assert.IsFalse(thisIterator.IsCompact);
                Assert.IsFalse(thisIterator.IsPeriod);
                Assert.IsTrue(thisIterator.Style == CommandIterator.StyleType.UnitCell);
                Assert.IsTrue(thisIterator.AxisName == "invest_InvestmentAxis");

                Assert.AreEqual(@"http://europa.eu/role/R4041", thisReport.Role);
                Assert.IsFalse(thisReport.IsTransposed);
            }
コード例 #4
0
        public Dictionary<string, object> GetElementDictionary( CommandIterator.IteratorType iteratorType )
        {
            //based on the iteratorType, this may affect the sorting
            Dictionary<string, object> elementDictionary = new Dictionary<string, object>();

            foreach( InstanceReportRow row in this.Rows )
            {
                if( string.IsNullOrEmpty( row.ElementName ) )
                    continue;

                if( !this.IsEquityReport && row.IsAbstractGroupTitle )
                    continue;

                string elementKey = row.ElementKey;
                if( !elementDictionary.ContainsKey( elementKey ) )
                {
                    InstanceReportRow tmpRow = (InstanceReportRow)row.Clone( false, false );
                    elementDictionary[ elementKey ] = tmpRow;
                }
            }

            return elementDictionary;
        }
コード例 #5
0
 private List<InstanceReportItem> GetItems( CommandIterator.IteratorType location )
 {
     return this.GetItems( location, false );
 }
コード例 #6
0
        private InstanceReportRow CreateStyleRow( int depth, CommandIterator iterator, object memberValue )
        {
            InstanceReportRow groupedRow = new InstanceReportRow();
            groupedRow.EmbedRequirements = new ColumnRowRequirement( iterator );
            groupedRow.EmbedRequirements.Add( iterator, memberValue );
            groupedRow.IsAbstractGroupTitle = true;
            groupedRow.GenerateEmbedLabel( groupedRow.EmbedRequirements, true );
            groupedRow.Level = depth;

            for( int c = 0; c < this.Columns.Count; c++ )
                groupedRow.Cells.Add( new Cell( this.Columns[ c ].Id ) );

            return groupedRow;
        }
コード例 #7
0
 private void ApplyRowStyles( CommandIterator[] rowIterators, ITraceMessenger messenger )
 {
     int r = 0;
     int depth = 0;
     Stack<CommandIterator> iteratorHierarchy = new Stack<CommandIterator>();
     LinkedList<CommandIterator> iterators = new LinkedList<CommandIterator>( rowIterators );
     bool hasUnitCell = Array.Exists( rowIterators, itr => itr.Style == CommandIterator.StyleType.UnitCell );
     this.ApplyRowStylesHierarchically( depth, ref r, iterators.First, iteratorHierarchy, hasUnitCell, messenger );
 }
コード例 #8
0
        private static void RemoveSelectionLabels( List<InstanceReportItem> items, CommandIterator.SelectionType selectionType )
        {
            CommandIterator iterator = CommandIterator.CreateDefault( selectionType );
            foreach( InstanceReportItem item in items )
            {
                if( item.EmbedRequirements == null )
                    continue;

                if( !item.EmbedRequirements.HasSelectionType( iterator ) )
                    continue;

                string label = item.EmbedRequirements.GetLabel( iterator, true );
                item.Labels.RemoveAll( lbl => lbl.Label == label );
            }
        }
コード例 #9
0
        public void PopulateEmbeddedReport( InstanceReport baseReport,
			CommandIterator[] columnIterators, CommandIterator[] rowIterators )
        {
            this.PopulateEmbeddedReport( baseReport, columnIterators, rowIterators, null );
        }
コード例 #10
0
 public bool HasSelectionType( CommandIterator iterator )
 {
     if( iterator.Selection == CommandIterator.SelectionType.Axis )
         return HasSelectionType( iterator.Selection, iterator.SelectionString, iterator.Filter );
     else
         return this.HasSelectionType( iterator.Selection );
 }
コード例 #11
0
        public KeyValuePair<string, object> GetMemberKeyValue( CommandIterator iterator )
        {
            switch( iterator.Selection )
            {
                case CommandIterator.SelectionType.Element:
                    return new KeyValuePair<string,object>( this.ElementKey, this.ElementRow );
                case CommandIterator.SelectionType.Period:
                    return new KeyValuePair<string,object>( this.Period.ToString(), this.Period );
                case CommandIterator.SelectionType.Unit:
                    return new KeyValuePair<string,object>( this.UnitLabel, this.Unit );
            }

            //this must be a segment...
            Segment segment = this.Segments.Find( seg => seg.DimensionInfo.dimensionId == iterator.SelectionString );
            KeyValuePair<string, object> kvpSegment = kvpSegment = new KeyValuePair<string, object>( iterator.SelectionString, segment );
            return kvpSegment;
        }
コード例 #12
0
        /// <summary>
        /// Return the combined label for the given commands.
        /// </summary>
        /// <param name="iterator">The label pieces.</param>
        /// <param name="showDefault">Whether or not to show a default label
        /// when one cannot be generated.</param>
        /// <returns></returns>
        public string GetLabel( CommandIterator iterator, bool showDefault )
        {
            if( iterator.Style == CommandIterator.StyleType.NoDisplay )
                return string.Empty;

            switch( iterator.Selection )
            {
                case CommandIterator.SelectionType.Element:
                    if( this.hiddenObjects.Contains( this.ElementRow ) )
                        return string.Empty;
                    else
                        return this.ElementLabel;

                case CommandIterator.SelectionType.Period:
                    if( this.hiddenObjects.Contains( this.Period ) )
                        return string.Empty;
                    else
                        return this.PeriodLabel;

                case CommandIterator.SelectionType.Unit:
                    if( this.hiddenObjects.Contains( this.Unit ) )
                        return string.Empty;
                    else
                        return this.UnitLabel;
            }

            if( this.Segments == null || this.Segments.Count == 0 )
                return string.Empty;

            int segIdx = this.Segments.FindIndex(
            seg =>
            {
                if( !string.Equals( seg.DimensionInfo.dimensionId, iterator.SelectionString ) )
                    return false;

                if( iterator.Filter == "*" )
                {
                    if( seg.IsDefaultForEntity )
                        return showDefault;
                    else
                        return true;
                }

                if( !string.Equals( seg.DimensionInfo.Id, iterator.Filter ) )
                    return false;

                if( seg.IsDefaultForEntity )
                    return showDefault;
                else
                    return true;
            } );

            if( segIdx == -1 )
                return string.Empty;
            else if( this.hiddenObjects.Contains( this.Segments[ segIdx ] ) )
                return string.Empty;
            else
                return this.SegmentLabels[ segIdx ];
        }
コード例 #13
0
        public void Add( CommandIterator iterator, object memberGroupValue )
        {
            switch( iterator.Selection )
            {
                case CommandIterator.SelectionType.Element:
                    this.ElementRow = memberGroupValue as InstanceReportRow;
                    break;
                case CommandIterator.SelectionType.Period:
                    this.Period = memberGroupValue as CalendarPeriod;
                    break;
                case CommandIterator.SelectionType.Unit:
                    this.Unit = (EmbeddedUnitWrapper)memberGroupValue;
                    break;
            }

            //this must be a segment...
            Segment segment = memberGroupValue as Segment;
            if( segment != null )
                this.Segments.Add( segment );
        }
コード例 #14
0
 public MainController(SampleContext context, CommandIterator commandIterator) : base(context, commandIterator)
 {
 }
コード例 #15
0
ファイル: EquityDataSet.cs プロジェクト: plamikcho/xbrlpoc
        /// <summary>
        /// Looks through each segment of each axis in the given report to
        /// determine which is column/row based, then passes the results on for
        /// embed processing.  The result is stored in <see
        /// cref="EquityCandidate"/>.
        /// </summary>
        /// <param name="baseReport">The <see cref="InstanceReport"/> upon
        /// which to generate an equity style report.</param>
        /// <returns>A <see cref="bool"/> indicating success.</returns>
        public bool PopulateEquityReport( InstanceReport baseReport )
        {
            Dictionary<string, CommandIterator> columnCommands = new Dictionary<string, CommandIterator>();
            foreach( string axis in baseReport.AxisByPresentation )
            {
                bool axisFound = false;
                foreach( InstanceReportColumn segmentColumn in this.SegmentColumns )
                {
                    if( segmentColumn.Segments == null || segmentColumn.Segments.Count == 0 )
                        continue;

                    foreach( Segment seg in segmentColumn.Segments )
                    {
                        if( string.Equals( seg.DimensionInfo.dimensionId, axis ) )
                        {
                            CommandIterator ci = new CommandIterator( CommandIterator.IteratorType.Column, axis, CommandIterator.StyleType.Compact, "*" );
                            columnCommands[ ci.AxisName ] = ci;
                            axisFound = true;
                        }
                    }

                    if( axisFound )
                        break;
                }
            }

            CommandIterator unitCmd = new CommandIterator( CommandIterator.IteratorType.Column, "unit", CommandIterator.StyleType.Grouped, "*" );
            columnCommands[ unitCmd.SelectionString ] = unitCmd;

            Dictionary<string, CommandIterator> rowCommands = new Dictionary<string, CommandIterator>();
            CommandIterator calCmd = new CommandIterator( CommandIterator.IteratorType.Row, "period", CommandIterator.StyleType.Grouped, "*" );
            rowCommands[ calCmd.SelectionString ] = calCmd;

            CommandIterator elCmd = new CommandIterator( CommandIterator.IteratorType.Row, "primary", CommandIterator.StyleType.Compact, "*" );
            rowCommands[ elCmd.SelectionString ] = elCmd;

            foreach( string axis in baseReport.AxisByPresentation )
            {
                if( columnCommands.ContainsKey( axis ) )
                    continue;

                if( rowCommands.ContainsKey( axis ) )
                    continue;

                CommandIterator specCmd = new CommandIterator( CommandIterator.IteratorType.Row, axis, CommandIterator.StyleType.Compact, "*" );
                rowCommands[ specCmd.AxisName ] = specCmd;
            }

            EmbedReport equityTransform = new EmbedReport();
            List<CommandIterator> colCmds = new List<CommandIterator>( columnCommands.Values );
            equityTransform.ColumnIterators = colCmds.ToArray();

            List<CommandIterator> rowCmds = new List<CommandIterator>( rowCommands.Values );
            equityTransform.RowIterators = rowCmds.ToArray();

            equityTransform.AxisByPresentation = baseReport.AxisByPresentation;
            if( equityTransform.ProcessEmbedCommands( baseReport, null ) )
            {
                this.EquityCandidate = equityTransform.InstanceReport;
                return true;
            }
            else
            {
                return false;
            }
        }
コード例 #16
0
        private List<InstanceReportItem> GetItems( CommandIterator.IteratorType location, bool removeAbstractGroupTitle )
        {
            List<InstanceReportItem> items = location == CommandIterator.IteratorType.Column ?
                this.Columns.ConvertAll( col => (InstanceReportItem)col ):
                this.Rows.ConvertAll( row => (InstanceReportItem)row );

            if( removeAbstractGroupTitle )
                items.RemoveAll( i => i.IsAbstractGroupTitle );

            return items;
        }
コード例 #17
0
        public Dictionary<string, object> GetPeriodDictionary( CommandIterator.IteratorType iteratorType )
        {
            List<CalendarPeriod> uniqueCalendars = new List<CalendarPeriod>();
            this.Columns.ForEach(
            col =>
            {
                CalendarPeriod cp = new CalendarPeriod( col.MyContextProperty.PeriodStartDate, col.MyContextProperty.PeriodEndDate );
                cp.PeriodType = col.MyContextProperty.PeriodType;

                int foundAt = uniqueCalendars.BinarySearch( cp );
                if( foundAt < 0 )
                    uniqueCalendars.Insert( ~foundAt, cp );
            } );

            if( uniqueCalendars.Count > 1 )
            {
                uniqueCalendars.RemoveAll(
                iCal =>
                {
                    if( iCal.PeriodType == Element.PeriodType.duration )
                        return false;

                    return ReportUtils.Exists( uniqueCalendars, dCal => DateTime.Equals( iCal.StartDate, dCal.EndDate ) );
                } );
            }

            if( uniqueCalendars.Count > 1 )
            {
                if( iteratorType == CommandIterator.IteratorType.Column )
                    uniqueCalendars.Sort( CalendarPeriod.ReportSorter );
                else
                    uniqueCalendars.Sort( CalendarPeriod.AscendingSorter );
            }

            Dictionary<string, object> periodDictionary = new Dictionary<string, object>();
            foreach( CalendarPeriod cp in uniqueCalendars )
            {
                periodDictionary[ cp.ToString() ] = cp;
            }
            return periodDictionary;
        }
コード例 #18
0
        public bool HasSelectionType( CommandIterator.SelectionType selectionType )
        {
            switch( selectionType )
            {
                case CommandIterator.SelectionType.Axis:
                    throw new NotSupportedException( "SelectionType: Axis is not supported by this form of the method." );
                case CommandIterator.SelectionType.Element:
                    return this.ElementRow != null;
                case CommandIterator.SelectionType.Period:
                    return this.Period != null;
                case CommandIterator.SelectionType.Unit:
                    return this.Unit != null;
            }

            return false;
        }
コード例 #19
0
        public Dictionary<string, object> GetUnitDictionary( CommandIterator.IteratorType iteratorType )
        {
            //based on the iteratorType, this may affect the sorting
            SortedDictionary<string, EmbeddedUnitWrapper> currencyCodes = new SortedDictionary<string, EmbeddedUnitWrapper>();
            foreach( InstanceReportColumn col in this.Columns )
            {
                UnitProperty up;
                string cc = GetColumnCurrencyCode( col, out up );
                if( currencyCodes.ContainsKey( cc ) )
                    currencyCodes[ cc ].AddOtherUnits( col.Units );
                else
                    currencyCodes[ cc ] = new EmbeddedUnitWrapper( up, col.Units );
            }

            //put USD first
            Dictionary<string, object> unitDictionary = new Dictionary<string, object>();
            if( currencyCodes.ContainsKey( InstanceUtils.USDCurrencyCode ) )
            {
                unitDictionary[ InstanceUtils.USDCurrencyCode ] = currencyCodes[ InstanceUtils.USDCurrencyCode ];
                currencyCodes.Remove( InstanceUtils.USDCurrencyCode );
            }

            //the rest in alphabetical order
            foreach( string key in currencyCodes.Keys )
            {
                unitDictionary[ key ] = currencyCodes[ key ];
            }

            return unitDictionary;
        }
コード例 #20
0
        //TODO make private
        public bool HasSelectionType( CommandIterator.SelectionType selectionType, string axis, string member )
        {
            if( selectionType == CommandIterator.SelectionType.Axis )
            {
                if( this.Segments == null || this.Segments.Count == 0 )
                    return false;

                Segment s = this.Segments.Find( seg => seg.DimensionInfo.dimensionId == axis );
                if( s == null )
                    return false;

                if( member == "*" )
                    return true;

                return s.DimensionInfo.Id == member;
            }
            else
            {
                return this.HasSelectionType( selectionType );
            }
        }
コード例 #21
0
        public void PopulateEmbeddedReport( InstanceReport baseReport,
			CommandIterator[] columnIterators, CommandIterator[] rowIterators, ITraceMessenger messenger )
        {
            this.IsMultiCurrency = baseReport.IsMultiCurrency;
            foreach( InstanceReportColumn col in this.Columns )
            {
                col.GenerateEmbedLabel();
            }

            foreach( InstanceReportRow row in this.Rows )
            {
                row.Cells.Clear();
                row.GenerateEmbedLabel();

                for( int c = 0; c < this.Columns.Count; c++ )
                    row.Cells.Add( new Cell() );
            }

            ColumnRowRequirement[,] netCells = new ColumnRowRequirement[ this.Rows.Count, this.Columns.Count ];
            for( int r = 0; r < this.Rows.Count; r++ )
            {
                for( int c = 0; c < this.Columns.Count; c++ )
                {
                    netCells[ r, c ] = BuildNetCell( this.Rows[ r ].EmbedRequirements, this.Columns[ c ].EmbedRequirements );
                }
            }

            for( int r = 0; r < this.Rows.Count; r++ )
            {
                for( int c = 0; c < this.Columns.Count; c++ )
                {
                    List<InstanceReportColumn> baseColumns = FindBaseColumns( netCells[ r, c ], baseReport.Columns );
                    if( baseColumns.Count == 0 )
                        continue;

                    List<InstanceReportRow> baseRows = FindBaseRows( netCells[ r, c ], baseReport.Rows );
                    if( baseRows.Count == 0 )
                        continue;

                    bool found = false;
                    foreach( InstanceReportColumn col in baseColumns )
                    {
                        foreach( InstanceReportRow row in baseRows )
                        {
                            //CEE:  By moving this up, we are using the "strict" logic
                            //Strict:  Instead of seeking to the first populated cell
                            //   the netCell is expected to point to 1 and only 1 cell
                            //found = true;

                            Cell bCell = row.Cells.Find( cell => cell.Id == col.Id );
                            if( bCell != null && bCell.HasData )
                            {
                                Cell clone = (Cell)bCell.Clone();
                                clone.ShowCurrencySymbol = false;

                                if( !this.IsEquityReport && this.IsMultiCurrency && row.IsMonetary )
                                {
                                    clone.CurrencyCode = col.CurrencyCode;
                                    clone.CurrencySymbol = col.CurrencySymbol;
                                    clone.IsMonetary = true;
                                }

                                this.Rows[ r ].Cells.RemoveAt( c );
                                this.Rows[ r ].Cells.Insert( c, clone );

                                //CEE:  By moving this down, we are using the "loose" logic
                                //Loose:  Instead of expecting the netCell to point to
                                //   1 and only 1 cell, we seek to the first populated cell
                                found = true;
                                break;
                            }
                        }

                        if( found )
                            break;
                    }
                }
            }

            //clean up columns
            this.RemoveEmptyColumns();

            if( this.Columns.Count == 0 )
                return;

            //clean up rows
            this.RemoveEmptyRows();

            this.MergeCurrencyDifferences();
            this.CheckAndScrubCurrencies();
            this.ApplyCustomUnitsEmbedded();

            //apply grouped and unitcell
            this.ApplyRowStyles( rowIterators, messenger );

            if( !this.IsEquityReport )
            {
                this.PromoteDefaultMemberGroups();
                this.RemoveDefaultMemberHeaders();
            }

            this.RelabelDefaultTotalRow();
            this.ApplyUnitCell();

            //how many unique periods are on these columns?
            //if 1, remove the label
            this.RemoveSingularPeriod();

            //if a unit occurs on all columns...
            //   remove it from the columns so it can't get promoted as "shared"
            //   save it so it can be added last
            string currencyLabel = this.RemoveSharedCurrency();

            //if a label occurs on all columns, shift it to the header
            this.PromoteSharedLabels();

            //if there is a shared currency label, add it last
            if( !string.IsNullOrEmpty( currencyLabel ) )
                this.ReportName += Environment.NewLine + currencyLabel;

            //copy over the footnotes
            this.PromoteFootnotes( baseReport );

            this.SynchronizeGrid();

            this.ProcessColumnHeaders();
        }
コード例 #22
0
        public void Remove( CommandIterator iterator, string memberGroupKey )
        {
            switch( iterator.Selection )
            {
                case CommandIterator.SelectionType.Element:
                    this.ElementRow = null;
                    break;
                case CommandIterator.SelectionType.Period:
                    this.Period = null;
                    break;
                case CommandIterator.SelectionType.Unit:
                    this.Unit = null;
                    break;
            }

            //this must be a segment...
            Segment segment = this.Segments.Find( seg => seg.DimensionInfo.dimensionId == memberGroupKey );
            if( segment != null )
                this.Segments.Remove( segment );
        }
コード例 #23
0
        public void ShowLabel( CommandIterator iterator, string memberGroupKey )
        {
            object objToHide = null;
            switch( iterator.Selection )
            {
                case CommandIterator.SelectionType.Element:
                    objToHide = this.ElementRow;
                    break;
                case CommandIterator.SelectionType.Period:
                    objToHide = this.Period;
                    break;
                case CommandIterator.SelectionType.Unit:
                    objToHide = this.Unit;
                    break;
            }

            //this must be a segment...
            if( objToHide == null )
                objToHide = this.Segments.Find( seg => seg.DimensionInfo.dimensionId == memberGroupKey );

            if( objToHide != null && this.hiddenObjects.Contains( objToHide ) )
                this.hiddenObjects.Remove( objToHide );
        }
コード例 #24
0
        /// <summary>
        /// Looks through each segment of each axis in the given report to
        /// determine which is column/row based, then passes the results on for
        /// embed processing.  The result is stored in <see
        /// cref="EquityCandidate"/>.
        /// </summary>
        /// <param name="baseReport">The <see cref="InstanceReport"/> upon
        /// which to generate an equity style report.</param>
        /// <returns>A <see cref="bool"/> indicating success.</returns>
        public bool PopulateEquityReport(InstanceReport baseReport)
        {
            Dictionary <string, CommandIterator> columnCommands = new Dictionary <string, CommandIterator>();

            foreach (string axis in baseReport.AxisByPresentation)
            {
                bool axisFound = false;
                foreach (InstanceReportColumn segmentColumn in this.SegmentColumns)
                {
                    if (segmentColumn.Segments == null || segmentColumn.Segments.Count == 0)
                    {
                        continue;
                    }

                    foreach (Segment seg in segmentColumn.Segments)
                    {
                        if (string.Equals(seg.DimensionInfo.dimensionId, axis))
                        {
                            CommandIterator ci = new CommandIterator(CommandIterator.IteratorType.Column, axis, CommandIterator.StyleType.Compact, "*");
                            columnCommands[ci.AxisName] = ci;
                            axisFound = true;
                        }
                    }

                    if (axisFound)
                    {
                        break;
                    }
                }
            }

            CommandIterator unitCmd = new CommandIterator(CommandIterator.IteratorType.Column, "unit", CommandIterator.StyleType.Grouped, "*");

            columnCommands[unitCmd.SelectionString] = unitCmd;



            Dictionary <string, CommandIterator> rowCommands = new Dictionary <string, CommandIterator>();
            CommandIterator calCmd = new CommandIterator(CommandIterator.IteratorType.Row, "period", CommandIterator.StyleType.Grouped, "*");

            rowCommands[calCmd.SelectionString] = calCmd;

            CommandIterator elCmd = new CommandIterator(CommandIterator.IteratorType.Row, "primary", CommandIterator.StyleType.Compact, "*");

            rowCommands[elCmd.SelectionString] = elCmd;

            foreach (string axis in baseReport.AxisByPresentation)
            {
                if (columnCommands.ContainsKey(axis))
                {
                    continue;
                }

                if (rowCommands.ContainsKey(axis))
                {
                    continue;
                }

                CommandIterator specCmd = new CommandIterator(CommandIterator.IteratorType.Row, axis, CommandIterator.StyleType.Compact, "*");
                rowCommands[specCmd.AxisName] = specCmd;
            }


            EmbedReport            equityTransform = new EmbedReport();
            List <CommandIterator> colCmds         = new List <CommandIterator>(columnCommands.Values);

            equityTransform.ColumnIterators = colCmds.ToArray();

            List <CommandIterator> rowCmds = new List <CommandIterator>(rowCommands.Values);

            equityTransform.RowIterators = rowCmds.ToArray();

            equityTransform.AxisByPresentation = baseReport.AxisByPresentation;
            if (equityTransform.ProcessEmbedCommands(baseReport, null))
            {
                this.EquityCandidate = equityTransform.InstanceReport;
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #25
0
        private Dictionary<string, int> CountEmbeddedPeriods( CommandIterator.IteratorType periodLocation )
        {
            Dictionary<string, int> periods = new Dictionary<string, int>();

            if( periodLocation == CommandIterator.IteratorType.Column )
            {
                this.Columns.ForEach(
                col =>
                {
                    if( col.EmbedRequirements != null )
                        periods[ col.EmbedRequirements.PeriodLabel ] = 1;
                } );
            }
            else
            {
                this.Rows.ForEach(
                row =>
                {
                    if( row.EmbedRequirements == null )
                        return;

                    if( string.IsNullOrEmpty( row.EmbedRequirements.PeriodLabel ) )
                        return;

                    periods[ row.EmbedRequirements.PeriodLabel ] = 1;
                } );
            }

            return periods;
        }
コード例 #26
0
    static void Main(string[] args)
    {
        CommandIterator commandIterator = new CommandIterator();

        commandIterator.Start();
    }
コード例 #27
0
        public Dictionary<string, object> GetInUseSegmentDictionary(
			IEnumerable<CommandIterator> iteratorHierarchy, CommandIterator currentIterator,
			out Segment defaultMember )
        {
            string axis = currentIterator.AxisName;
            defaultMember = this.AxisMemberDefaults.ContainsKey( axis ) ?
                this.AxisMemberDefaults[ axis ] : null;

            Segment colSeg = null;
            Dictionary<string, object> segmentDictionary = new Dictionary<string, object>();
            if( string.Equals( currentIterator.Filter, "*" ) )
            {
                foreach( InstanceReportColumn col in this.Columns )
                {
                    colSeg = col.GetAxisMember( axis, defaultMember );
                    if( colSeg == null )
                        continue;

                    if( segmentDictionary.ContainsKey( colSeg.DimensionInfo.Id ) )
                        continue;

                    if( col.ContainsSegmentMembers( iteratorHierarchy ) )
                        segmentDictionary[ colSeg.DimensionInfo.Id ] = colSeg;
                }

                Segment[] allSegments = new Segment[ segmentDictionary.Count ];
                segmentDictionary.Values.CopyTo( allSegments, 0 );
                Array.Sort( allSegments, this.CompareSegments );

                segmentDictionary.Clear();
                foreach( Segment seg in allSegments )
                {
                    segmentDictionary[ seg.DimensionInfo.Id ] = seg;
                }
            }
            else
            {
                foreach( InstanceReportColumn col in this.Columns )
                {
                    colSeg = col.GetAxisMember( axis, defaultMember );
                    if( colSeg != null && string.Equals( currentIterator.Filter, colSeg.DimensionInfo.Id ) )
                    {
                        segmentDictionary[ colSeg.DimensionInfo.Id ] = colSeg;
                        break;
                    }
                }
            }

            return segmentDictionary;
        }
コード例 #28
0
 public DogController(SampleContext context, CommandIterator commandIterator, string dogName) : base(context, commandIterator)
 {
 }