示例#1
0
 public void NodeAdded(AListNode <K, T> child, AListInnerBase <K, T> parent)
 {
     if (_nodes == null)
     {
         _nodes = new BMultiMap <AListNode <K, T>, AListInnerBase <K, T> >(CompareNodeHashCodes, CompareInnerHashCodes);
     }
     _nodes.Add(new KeyValuePair <AListNode <K, T>, AListInnerBase <K, T> >(child, parent));
 }
示例#2
0
		void WhereClausesOpt(ref LNode name)
		{
			TokenType la0;
			#line 1163 "EcsParserGrammar.les"
			var list = new BMultiMap<Symbol,LNode>();
			#line default
			// Line 1164: (WhereClause)*
			for (;;) {
				la0 = LA0;
				if (la0 == TT.ContextualKeyword)
					list.Add(WhereClause());
				else
					break;
			}
			#line 1165 "EcsParserGrammar.les"
			if ((list.Count != 0)) {
				if ((!name.CallsMin(S.Of, 2))) {
					Error("'{0}' is not generic and cannot use 'where' clauses.", name.ToString());
				} else {
					var tparams = name.Args.ToRWList();
					for (int i = 1; i < tparams.Count; i++) {
						var wheres = list[TParamSymbol(tparams[i])];
						tparams[i] = tparams[i].PlusAttrs(wheres);
						wheres.Clear();
					}
					name = name.WithArgs(tparams.ToRVList());
					if ((list.Count > 0)) {
						Error(list[0].Value, "There is no type parameter named '{0}'", list[0].Key);
					}
				}
			}
			#line default
		}
示例#3
0
 public void ItemAdded(T item, AListLeaf <K, T> parent)
 {
     _items.Add(new KeyValuePair <T, AListLeaf <K, T> >(item, parent));
 }
示例#4
0
        private void UpdateGraph(PlotModel model, MSet <EzDataPoint> points)
        {
            model.Series.Clear();
            var allSeries = new BMultiMap <string, EzDataPoint>((a, b) => string.CompareOrdinal(a, b));

            foreach (var dp in points)
            {
                allSeries.Add(dp.Series, dp);
            }

            // Add text labels to axis if the data uses text Parameters
            CategoryAxis cAxis = null;

            if (points.Any(dp => dp.Parameter is string))
            {
                var headings = new SortedSet <string>(points.Select(dp => dp.Parameter as string).WhereNotNull());
                cAxis = model.Axes.OfType <CategoryAxis>().SingleOrDefault();
                if (cAxis == null)
                {
                    model.Axes.Add(cAxis = new CategoryAxis {
                        MajorGridlineStyle = LineStyle.Dot,
                        Position           = AxisPosition.Bottom
                    });
                }
                cAxis.Labels.Clear();
                foreach (var text in headings)
                {
                    cAxis.Labels.Add(text);
                }
                cAxis.Key = "CategoryAxis";
            }

            int iSeries = 0;

            foreach (var series in allSeries.Values)
            {
                if (series.Any(p => p.Parameter is string))
                {
                    var plotSeries = new ColumnSeries {
                        Title = series.First().Series
                    };
                    plotSeries.XAxisKey = cAxis.Key;
                    foreach (var dp in series)
                    {
                        plotSeries.Items.Add(new ColumnItem(dp.Value, cAxis.Labels.IndexOf(dp.Parameter.ToString())));
                    }
                    model.Series.Add(plotSeries);
                }
                else
                {
                    var plotSeries = new LineSeries {
                        Title = series.First().Series
                    };
                    if (cAxis != null)
                    {
                        plotSeries.XAxisKey = cAxis.Key;
                    }
                    // There are 7 marker types starting at 1, excluding None (0)
                    plotSeries.MarkerType = (MarkerType)((iSeries % 7) + 1);
                    plotSeries.MarkerSize = 4;
                    plotSeries.MarkerFill = plotSeries.Color;
                    foreach (var dp in series)
                    {
                        plotSeries.Points.Add(new OxyPlot.DataPoint(Convert.ToDouble(dp.Parameter), dp.Value));
                    }
                    model.Series.Add(plotSeries);
                }
                iSeries++;
            }
        }