当前位置: 首页>>代码示例>>C#>>正文


C# Tuple.Add方法代码示例

本文整理汇总了C#中Tuple.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Tuple.Add方法的具体用法?C# Tuple.Add怎么用?C# Tuple.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tuple的用法示例。


在下文中一共展示了Tuple.Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Solve

        public new Tuple<int, int, int> Solve()
        {
            Tuple<int,int,int> results = new Tuple<int, int, int>(0,0,0);

            do
            {  // eliminated, solved, rounds
                Tuple<int,int,int> progress = new Tuple<int, int, int>(0,0,0);

                progress = progress.Add(base.Solve());

                if(base.IsSolved())
                {
                    results = results.Add(progress);
                    break;
                }

                progress = progress.Add(SolveModerate());

                if(progress.Item1==0 && progress.Item2==0)
                {
                    results = results.Add(progress);
                    break;
                }

                results = results.Add(progress);
            }
            while(!base.IsSolved());

            return results;
        }
开发者ID:T5C2U7B,项目名称:SudokuSolverAJR,代码行数:30,代码来源:Moderate.cs

示例2: Main

	public static void Main() {
        var test = new Tuple<int, Test.Tester>();
        test.Add(Test.Tester.Blue);
	}
开发者ID:Ghost53574,项目名称:CSdk,代码行数:4,代码来源:Test.cs

示例3: SelfTest

			private void SelfTest()
			{
				for (int d1 = 0; d1 < this.dimensions.Length - 1; d1++)
				{
					for (int d2 = d1 + 1; d2 < this.dimensions.Length; d2++)
					{
						for (int f1 = 0; f1 < this.dimensions[d1]; f1++)
						{
							for (int f2 = 0; f2 < this.dimensions[d2]; f2++)
							{
								Tuple tuple = new Tuple();
								tuple.Add(new FeatureInfo(d1, f1));
								tuple.Add(new FeatureInfo(d2, f2));

								if (!this.testCases.IsTupleCovered(tuple))
								{
									throw new ApplicationException("PairwiseStrategy self-test failed : Not all pairs are covered!");
								}
							}
						}
					}
				}
			}
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:23,代码来源:PairwiseStrategy.cs

示例4: ExtendTupleSet

			private void ExtendTupleSet(int dimension, int feature)
			{
				// If tuples for [dimension][feature] already exists, it's no needs to add more tuples.
				if (this.uncoveredTuples[dimension][feature].Count > 0)
				{
					return;
				}

				// If maximum tuple length for [dimension][feature] is reached, it's no needs to add more tuples.
				if (this.currentTupleLength[dimension][feature] == MaxTupleLength)
				{
					return;
				}

				this.currentTupleLength[dimension][feature]++;

				int tupleLength = this.currentTupleLength[dimension][feature];

				if (tupleLength == 1)
				{
					Tuple tuple = new Tuple();

					tuple.Add(new FeatureInfo(dimension, feature));

					if (this.testCases.IsTupleCovered(tuple))
					{
						return;
					}

					this.uncoveredTuples[dimension][feature].Add(tuple);
				}
				else
				{
					for (int d = 0; d < this.dimensions.Length; d++)
					{
						for (int f = 0; f < this.dimensions[d]; f++)
						{
							Tuple tuple = new Tuple();
							tuple.Add(new FeatureInfo(d, f));

							if (tuple[0].Dimension == dimension)
							{
								continue;
							}

							tuple.Add(new FeatureInfo(dimension, feature));

							if (this.testCases.IsTupleCovered(tuple))
							{
								continue;
							}

							this.uncoveredTuples[dimension][feature].Add(tuple);
						}
					}
				}
			}
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:57,代码来源:PairwiseStrategy.cs

示例5: RunSolverFunction

        Tuple<int, int, int> RunSolverFunction(SolverDelegate solverFunction)
        {
            Tuple<int,int,int> totals = new Tuple<int, int, int>(0,0,0);
            for(int counter=1;counter<=StaticSudoku.Dimension;counter++)
            {
                int solved = 0;
                int eliminated = solverFunction(counter);

                if(eliminated > 0)
                {
                    totals = totals.Add(eliminated, solved);
                    totals = totals.Add(ScanNakedSingles());
                }
            }
            return totals;
        }
开发者ID:T5C2U7B,项目名称:SudokuSolverAJR,代码行数:16,代码来源:Moderate.cs

示例6: ExecutePlan

        Tuple<int, int, int> ExecutePlan(List<SolverDelegate> functionList)
        {
            Tuple<int,int,int> total = new Tuple<int, int, int>(0,0,0);
            Tuple<int, int, int> round;

            do
            {
                round = new Tuple<int, int, int>(0,0,0);

                foreach (SolverDelegate function in functionList)
                {
                    for (int counter = 1; counter <= StaticSudoku.Dimension; counter++)
                    {
                        round = round.Add(EliminateCandidates(), 0);
                        round = round.Add(function(counter), 0);
                        //round = round.Add(RunSolverFunction(function));
                        round = round.Add(ScanNakedSingles());
                    }
                }

                total = total.Add(round);

            }
            while (round.Item1 + round.Item2 > 0);

            return total;
        }
开发者ID:T5C2U7B,项目名称:SudokuSolverAJR,代码行数:27,代码来源:Moderate.cs

示例7: Go

    public void Go()
    {
      var list = getFuturesOutputList();

      var startDate = DateTime.Now.AddMonths(-2);

      foreach (var item in list.Where(x => x.LastTrade > startDate))
      {
        using (var dc = SymmetryDataSource.ReadWrite())
        {
          try
          {
            item.InflateDetails();
            // we get some dodgy items eg TYZ6 with lasttrade date of Sept 2015
            if (!item.LastTradeMakesSense())
            {
              Logger.Error(
                string.Format("Not going to process dodgy looking item from bbg. Ticker = {0} and LastTrade={1}",
                  item.BbgCode, item.LastTrade), typeof (FutureMaintainer));
              continue;
            }

            Logger.Info(string.Format("Considering {0}...", item.BbgCode), typeof (FutureMaintainer));

            // try to find the item using last trade date first as this was retrieved by getting the future chain.
            // we might be able to prevent hitting bloomberg against for the contract static specifically
            var fi = findPossible(item, item.LastTrade, dc);

            if (fi == null && item.InflateDetails())
              fi = findPossible(item, item.Maturity, dc);

            // if we've managed to find the contract and it hasn't got the bloombergID that we're looking for, then update it
            if (fi != null && String.Compare(item.BbgCode, fi.SymmetryCode, StringComparison.OrdinalIgnoreCase) != 0)
            {
              Logger.Info(string.Format("Changing SymmetryCode from {0} to {1}", fi.SymmetryCode, item.BbgCode),
                typeof (FutureMaintainer));
              fi.SymmetryCode = item.BbgCode;
              Symmetry.Data.FIChangeTracking.SetModified(fi, dc);
              dc.SaveChanges();
            }


            if (fi == null)
            {
              if (item.InflateDetails())
              {
                Logger.Info(string.Format("Adding {0} to FI table...", item.BbgCode), typeof (FutureMaintainer));

                fi = dc.FIs.Add(new FI()
                {
                  Currency = item.Ccy,
                  SymmetryCode = item.BbgCode,
                  InstrumentType = item.InstType,
                  DisplayName = item.Description,
                  Maturity = item.Maturity,
                  Tenor = item.Tenor
                });

                dc.SaveChanges();
              }
              else
              {
                continue;
              }
            }


            var maps = new Tuple<IdentifierType, string>[]
            {
              new Tuple<IdentifierType, string>(IdentifierType.Bloomberg, item.BbgCode),
              new Tuple<IdentifierType, string>(IdentifierType.RIC, item.RIC),
              new Tuple<IdentifierType, string>(IdentifierType.Orchestrade, item.OT_ID)
            }.ToList();


            if (fi.InstrumentType == InstrumentType.IRFuture && item.LastTrade > DateTime.Today)
              maps.Add(new Tuple<IdentifierType, string>(IdentifierType.MLPCurveCode, item.RIC));

            foreach (var map in maps)
            {
              if (string.IsNullOrEmpty(map.Item2))
                continue;

              var identifiers = FIHelpers.GetFIIdentifiers(fi.SymmetryCode, map.Item1, dc,
                Symmetry.Core.ThrowBehavior.DontThrow);

              //if (identifiers != null && identifiers.Length > 1)
              //  System.Diagnostics.Debugger.Break();

              if (identifiers == null || identifiers.Length < 2)
              {
                // no point updating if already the same
                if (identifiers != null && identifiers.Length == 1 &&
                    String.Compare(identifiers[0], map.Item2, StringComparison.OrdinalIgnoreCase) == 0)
                  continue;

                Logger.Info(
                  string.Format("Setting {0} identifier : [{1}] = [{2}]", fi.SymmetryCode, map.Item1, map.Item2),
                  typeof (FutureMaintainer));

//.........这里部分代码省略.........
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:FutureMaintainer.cs


注:本文中的Tuple.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。