예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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;
        }
예제 #4
0
 public IEnumerable <Tuple <int, int> > UpperIsTarget(IFieldsGraph fieldsGraph)
 {
     return(Direction.AllUpper.Take(5).Shuffle().Select(dir => _firstPosition.Add(dir))
            .Concat(new[] { _firstPosition })
            .Concat(_whiteCoords)
            .Concat(Direction.AllUpper.Take(3).SelectMany(
                        dir => _whiteCoords.Select(coord => coord.Add(dir)))));
 }
예제 #5
0
            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);
                        }
                    }
                }
            }
예제 #6
0
    static void Main(string[] args)
    {
        string[] fullName     = Console.ReadLine().Split();
        string   names        = fullName[0] + " " + fullName[1];
        string   neighborhood = fullName[2];

        var person = new Tuple <string, string>(names, neighborhood);

        person.Add(person);
        Console.WriteLine(person);

        string[] literBeer = Console.ReadLine().Split();
        string   name      = literBeer[0];
        int      liter     = int.Parse(literBeer[1]);

        var beer = new Tuple <string, int>(name, liter);

        beer.Add(beer);
        Console.WriteLine(beer);


        string[] digit      = Console.ReadLine().Split();
        int      integerNum = int.Parse(digit[0]);
        double   doubleNum  = double.Parse(digit[1]);

        var integerAndDouble = new Tuple <int, double>(integerNum, doubleNum);

        integerAndDouble.Add(integerAndDouble);
        Console.WriteLine(integerAndDouble);
    }
예제 #7
0
        public void AddTest()
        {
            var v1 = new Tuple(3, -2, 5, 1);
            var v2 = new Tuple(-2, 3, 1, 0);
            var v3 = v1.Add(v2);

            Check.That(v3).IsEqualTo(new Tuple(1, 1, 6, 1));
        }
예제 #8
0
        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);
        }
예제 #9
0
        public void Can_Add_Tuples()
        {
            //Given
            var a1             = new Tuple(3, -2, 5, 1);
            var a2             = new Tuple(-2, 3, 1, 0);
            var expectedResult = new Tuple(1, 1, 6, 1);

            //Then
            var actualResult = a1.Add(a2);

            Assert.Equal(expectedResult, actualResult);
        }
예제 #10
0
 private void SelfTest()
 {
     for (int i = 0; i < dimensions.Length - 1; i++)
     {
         for (int j = i + 1; j < dimensions.Length; j++)
         {
             for (int k = 0; k < dimensions[i]; k++)
             {
                 for (int l = 0; l < dimensions[j]; l++)
                 {
                     Tuple tuple = new Tuple();
                     tuple.Add(new FeatureInfo(i, k));
                     tuple.Add(new FeatureInfo(j, l));
                     if (!testCases.IsTupleCovered(tuple))
                     {
                         throw new ApplicationException("PairwiseStrategy self-test failed : Not all pairs are covered!");
                     }
                 }
             }
         }
     }
 }
예제 #11
0
            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!");
                                }
                            }
                        }
                    }
                }
            }
예제 #12
0
            private void ExtendTupleSet(int dimension, int feature)
            {
                if (uncoveredTuples[dimension][feature].Count > 0 || currentTupleLength[dimension][feature] == 2)
                {
                    return;
                }
                currentTupleLength[dimension][feature]++;
                int num = currentTupleLength[dimension][feature];

                if (num == 1)
                {
                    Tuple tuple = new Tuple();
                    tuple.Add(new FeatureInfo(dimension, feature));
                    if (!testCases.IsTupleCovered(tuple))
                    {
                        uncoveredTuples[dimension][feature].Add(tuple);
                    }
                    return;
                }
                for (int i = 0; i < dimensions.Length; i++)
                {
                    for (int j = 0; j < dimensions[i]; j++)
                    {
                        Tuple tuple = new Tuple();
                        tuple.Add(new FeatureInfo(i, j));
                        if (tuple[0].Dimension != dimension)
                        {
                            tuple.Add(new FeatureInfo(dimension, feature));
                            if (!testCases.IsTupleCovered(tuple))
                            {
                                uncoveredTuples[dimension][feature].Add(tuple);
                            }
                        }
                    }
                }
            }
			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);
						}
					}
				}
			}
예제 #14
0
 public Register(string name, Func <ISubView> subViewCreator, Func <ViewModel> viewModelCreator)
 {
     _registry.Add(name, new Tuple(subViewCreator, viewModelCreator));
 }
예제 #15
0
        Variable GetCoreProperty(string propName, ParsingScript script = null)
        {
            Variable result = Variable.EmptyInstance;

            if (m_propertyMap.TryGetValue(propName, out result) ||
                m_propertyMap.TryGetValue(GetRealName(propName), out result))
            {
                return(result);
            }
            else if (propName.Equals(Constants.OBJECT_PROPERTIES, StringComparison.OrdinalIgnoreCase))
            {
                return(new Variable(GetProperties()));
            }
            else if (propName.Equals(Constants.OBJECT_TYPE, StringComparison.OrdinalIgnoreCase))
            {
                return(new Variable((int)Type));
            }
            else if (propName.Equals(Constants.SIZE, StringComparison.OrdinalIgnoreCase))
            {
                return(new Variable(GetSize()));
            }
            else if (propName.Equals(Constants.UPPER, StringComparison.OrdinalIgnoreCase))
            {
                return(new Variable(AsString().ToUpper()));
            }
            else if (propName.Equals(Constants.LOWER, StringComparison.OrdinalIgnoreCase))
            {
                return(new Variable(AsString().ToLower()));
            }
            else if (propName.Equals(Constants.STRING, StringComparison.OrdinalIgnoreCase))
            {
                return(new Variable(AsString()));
            }
            else if (propName.Equals(Constants.FIRST, StringComparison.OrdinalIgnoreCase))
            {
                if (Tuple != null && Tuple.Count > 0)
                {
                    return(Tuple[0]);
                }
                return(AsString().Length > 0 ? new Variable("" + AsString()[0]) : Variable.EmptyInstance);
            }
            else if (propName.Equals(Constants.LAST, StringComparison.OrdinalIgnoreCase))
            {
                if (Tuple != null && Tuple.Count > 0)
                {
                    return(Tuple.Last <Variable>());
                }
                return(AsString().Length > 0 ? new Variable("" + AsString().Last <char>()) : Variable.EmptyInstance);
            }
            else if (script != null && propName.Equals(Constants.INDEX_OF, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);

                string           search    = Utils.GetSafeString(args, 0);
                int              startFrom = Utils.GetSafeInt(args, 1, 0);
                string           param     = Utils.GetSafeString(args, 2, "no_case");
                StringComparison comp      = param.Equals("case", StringComparison.OrdinalIgnoreCase) ?
                                             StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                return(new Variable(AsString().IndexOf(search, startFrom, comp)));
            }
            else if (script != null && propName.Equals(Constants.SUBSTRING, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);

                int startFrom = Utils.GetSafeInt(args, 0, 0);
                int length    = Utils.GetSafeInt(args, 1, AsString().Length);
                length = Math.Min(length, AsString().Length - startFrom);

                return(new Variable(AsString().Substring(startFrom, length)));
            }
            else if (script != null && propName.Equals(Constants.REVERSE, StringComparison.OrdinalIgnoreCase))
            {
                script.GetFunctionArgs();
                if (Tuple != null)
                {
                    Tuple.Reverse();
                }
                else if (Type == VarType.STRING)
                {
                    char[] charArray = AsString().ToCharArray();
                    Array.Reverse(charArray);
                    String = new string(charArray);
                }

                return(this);
            }
            else if (script != null && propName.Equals(Constants.SORT, StringComparison.OrdinalIgnoreCase))
            {
                script.GetFunctionArgs();
                Sort();

                return(this);
            }
            else if (script != null && propName.Equals(Constants.SPLIT, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args   = script.GetFunctionArgs();
                string          sep    = Utils.GetSafeString(args, 0, " ");
                var             option = Utils.GetSafeString(args, 1);

                return(TokenizeFunction.Tokenize(AsString(), sep, option));
            }
            else if (script != null && propName.Equals(Constants.JOIN, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                string          sep  = Utils.GetSafeString(args, 0, " ");
                if (Tuple == null)
                {
                    return(new Variable(AsString()));
                }

                var join = string.Join(sep, Tuple);
                return(new Variable(join));
            }
            else if (script != null && propName.Equals(Constants.ADD, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);
                Variable var = Utils.GetSafeVariable(args, 0);
                if (Tuple != null)
                {
                    Tuple.Add(var);
                }
                else if (Type == VarType.NUMBER)
                {
                    Value += var.AsDouble();
                }
                else
                {
                    String += var.AsString();
                }
                return(var);
            }
            else if (script != null && propName.Equals(Constants.AT, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);
                int at = Utils.GetSafeInt(args, 0);

                if (Tuple != null && Tuple.Count > 0)
                {
                    return(Tuple.Count > at ? Tuple[at] : Variable.EmptyInstance);
                }
                string str = AsString();
                return(str.Length > at ? new Variable("" + str[at]) : Variable.EmptyInstance);
            }
            else if (script != null && propName.Equals(Constants.REPLACE, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 2, propName);
                string oldVal = Utils.GetSafeString(args, 0);
                string newVal = Utils.GetSafeString(args, 1);

                return(new Variable(AsString().Replace(oldVal, newVal)));
            }
            else if (propName.Equals(Constants.EMPTY_WHITE, StringComparison.OrdinalIgnoreCase))
            {
                bool isEmpty = string.IsNullOrWhiteSpace(AsString());
                return(new Variable(isEmpty));
            }
            else if (script != null && propName.Equals(Constants.REPLACE_TRIM, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 2, propName);
                string currentValue = AsString();

                for (int i = 0; i < args.Count; i += 2)
                {
                    string oldVal = Utils.GetSafeString(args, i);
                    string newVal = Utils.GetSafeString(args, i + 1);
                    currentValue = currentValue.Replace(oldVal, newVal);
                }

                return(new Variable(currentValue.Trim()));
            }
            else if (script != null && propName.Equals(Constants.CONTAINS, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);
                string           val   = Utils.GetSafeString(args, 0);
                string           param = Utils.GetSafeString(args, 1, "no_case");
                StringComparison comp  = param.Equals("case", StringComparison.OrdinalIgnoreCase) ?
                                         StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                bool contains = false;
                if (Type == Variable.VarType.ARRAY)
                {
                    string lower = val.ToLower();
                    contains = m_dictionary != null && m_dictionary.ContainsKey(lower);
                    if (!contains && Tuple != null)
                    {
                        foreach (var item in Tuple)
                        {
                            if (item.AsString().Equals(val, comp))
                            {
                                contains = true;
                                break;
                            }
                        }
                    }
                }
                else
                {
                    contains = val != "" && AsString().IndexOf(val, comp) >= 0;
                }
                return(new Variable(contains));
            }
            else if (script != null && propName.Equals(Constants.EQUALS, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);
                string           val   = Utils.GetSafeString(args, 0);
                string           param = Utils.GetSafeString(args, 1, "no_case");
                StringComparison comp  = param.Equals("case", StringComparison.OrdinalIgnoreCase) ?
                                         StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                return(new Variable(AsString().Equals(val, comp)));
            }
            else if (script != null && propName.Equals(Constants.STARTS_WITH, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);
                string           val   = Utils.GetSafeString(args, 0);
                string           param = Utils.GetSafeString(args, 1, "no_case");
                StringComparison comp  = param.Equals("case", StringComparison.OrdinalIgnoreCase) ?
                                         StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                return(new Variable(AsString().StartsWith(val, comp)));
            }
            else if (script != null && propName.Equals(Constants.ENDS_WITH, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> args = script.GetFunctionArgs();
                Utils.CheckArgs(args.Count, 1, propName);
                string           val   = Utils.GetSafeString(args, 0);
                string           param = Utils.GetSafeString(args, 1, "no_case");
                StringComparison comp  = param.Equals("case", StringComparison.OrdinalIgnoreCase) ?
                                         StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

                return(new Variable(AsString().EndsWith(val, comp)));
            }
            else if (script != null && propName.Equals(Constants.TRIM, StringComparison.OrdinalIgnoreCase))
            {
                script.GetFunctionArgs();
                return(new Variable(AsString().Trim()));
            }
            else if (propName.Equals(Constants.KEYS, StringComparison.OrdinalIgnoreCase))
            {
                List <Variable> results = GetAllKeys();
                return(new Variable(results));
            }

            return(result);
        }
예제 #16
0
파일: Test.cs 프로젝트: Ghost53574/CSdk
	public static void Main() {
        var test = new Tuple<int, Test.Tester>();
        test.Add(Test.Tester.Blue);
	}
			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!");
								}
							}
						}
					}
				}
			}
예제 #18
0
    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));

                FIBondHelpers.SetOrUpdateIdentifier(fi, map.Item1, map.Item2, dc);
              }
            }

            if (fi.FIFuture == null)
            {
              Logger.Info(string.Format("Adding FIFuture entry for {0}", item.BbgCode), typeof (FutureMaintainer));

              item.InflateDetails();
              fi.FIFuture = new FIFuture()
              {
                BbgBase = item.SourceSpec.BbgStart,
                BbgSuffix = item.SourceSpec.BbgSuffix,
                ReutersBase = item.SourceSpec.RICStart,
                Ccy = item.Ccy,
                Exchange = item.Exchange,
                FirstNotice = item.FirstNotice,
                FirstTradeDate = item.FirstTrade,
                LastDelivery = item.LastDelivery,
                LastTradeDate = item.LastTrade
              };
              dc.SaveChanges();
            }

            dc.SaveChanges();
          }
          catch (Exception ex_)
          {
            Logger.Error(string.Format("Error thrown updating {0}", item.BbgCode), typeof (FutureMaintainer));
          }
        }
      }
      MaintainIntradayFuturesStatics();
    }
예제 #19
0
        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;
        }
예제 #20
0
        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;
        }