예제 #1
0
        public MarketCondition(params Action <MarketCondition>[] actions)
        {
            ValuationDate           = new SetOnce <Date>("ValuationDate");
            MktQuote                = new SetOnce <Dictionary <string, Tuple <PriceQuoteType, double> > >("MktQuote");
            CreditSpread            = new SetOnce <ISpread>("CreditSpread");
            SpotPrices              = new SetOnce <Dictionary <string, double> >("SpotPrice");
            FxSpot                  = new SetOnce <Dictionary <string, double> >("FxSpot");
            Correlations            = new SetOnce <Dictionary <string, IVolSurface> >("Correlations");
            DiscountCurve           = new SetOnce <IYieldCurve>("DiscountCurve");
            FixingCurve             = new SetOnce <IYieldCurve>("FixingCurve");
            RiskfreeCurve           = new SetOnce <IYieldCurve>("RiskfreeCurve");
            UnderlyingDiscountCurve = new SetOnce <IYieldCurve>("UnderlyingDiscountCurve");
            DividendCurves          = new SetOnce <Dictionary <string, IYieldCurve> >("DividendCurve");
            VolSurfaces             = new SetOnce <Dictionary <string, IVolSurface> >("VolSurface");
            FgnDiscountCurve        = new SetOnce <IYieldCurve>("FgnDiscountCurve");
            FgnFixingCurve          = new SetOnce <IYieldCurve>("FgnFixingCurve");
            FxSpots                 = new SetOnce <FxSpot[]>("FxSpots");

            SettlementCcyDiscountCurve = new SetOnce <IYieldCurve>("SettlementCcyDiscountCurve");
            SettlementCcyFixingCurve   = new SetOnce <IYieldCurve>("SettlementCcyFixingCurve");

            SurvivalProbabilityCurve = new SetOnce <IYieldCurve>("SurvialProbabilityCurve");

            HistoricalIndexRates = new SetOnce <Dictionary <IndexType, SortedDictionary <Date, double> > >("HistoricalIndexRates");
            YieldCurves          = new SetOnce <Dictionary <string, IYieldCurve> >("YieldCurves");
            foreach (var action in actions)
            {
                action(this);
            }
        }
예제 #2
0
        public virtual void TestSetMultiThreaded()
        {
            SetOnce<int?> set = new SetOnce<int?>();
            SetOnceThread[] threads = new SetOnceThread[10];
            Random random = Random();
            for (int i = 0; i < threads.Length; i++)
            {
                threads[i] = new SetOnceThread(random);
                threads[i].Name = "t-" + (i + 1);
                threads[i].Set = set;
            }

            foreach (ThreadClass t in threads)
            {
                t.Start();
            }

            foreach (ThreadClass t in threads)
            {
                t.Join();
            }

            foreach (SetOnceThread t in threads)
            {
                if (t.Success)
                {
                    int expectedVal = Convert.ToInt32(t.Name.Substring(2));
                    Assert.AreEqual(expectedVal, t.Set.Get(), "thread " + t.Name);
                }
            }
        }
예제 #3
0
 public virtual void TestSetOnce_mem()
 {
     SetOnce<int?> set = new SetOnce<int?>();
     set.Set(new int?(5));
     Assert.AreEqual(5, (int)set.Get());
     set.Set(new int?(7));
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Coinche.Server.ConnectionInformation"/> class.
 /// </summary>
 /// <param name="connection">Connection.</param>
 public ConnectionInformation(Connection connection)
 {
     IsGameReady = false;
     _connection = connection;
     _pseudo     = new SetOnce <string>();
     _lobby      = null;
 }
예제 #5
0
 public virtual void TestEmptyCtor()
 {
     SetOnce<int?> set = new SetOnce<int?>();
     Assert.IsNull(set.Get());
 }
예제 #6
0
 /// <summary>
 /// Creates a new merge policy instance with default settings for noCFSRatio
 /// and maxCFSSegmentSize. this ctor should be used by subclasses using different
 /// defaults than the <seealso cref="MergePolicy"/>
 /// </summary>
 protected internal MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize)
 {
     Writer = new SetOnce <IndexWriter>();
     this.NoCFSRatio_Renamed = defaultNoCFSRatio;
     this.MaxCFSSegmentSize  = defaultMaxCFSSegmentSize;
 }
예제 #7
0
 /// <summary>
 /// Creates a new merge policy instance with default settings for noCFSRatio
 /// and maxCFSSegmentSize. this ctor should be used by subclasses using different
 /// defaults than the <seealso cref="MergePolicy"/>
 /// </summary>
 protected internal MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize)
 {
     Writer = new SetOnce<IndexWriter>();
     this.NoCFSRatio_Renamed = defaultNoCFSRatio;
     this.MaxCFSSegmentSize = defaultMaxCFSSegmentSize;
 }
예제 #8
0
 /// <summary>
 /// Creates a new merge policy instance with default settings for <see cref="m_noCFSRatio"/>
 /// and <see cref="m_maxCFSSegmentSize"/>. This ctor should be used by subclasses using different
 /// defaults than the <see cref="MergePolicy"/>
 /// </summary>
 protected MergePolicy(double defaultNoCFSRatio, long defaultMaxCFSSegmentSize)
 {
     m_writer                 = new SetOnce <IndexWriter>();
     this.m_noCFSRatio        = defaultNoCFSRatio;
     this.m_maxCFSSegmentSize = defaultMaxCFSSegmentSize;
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Server.UtilsTest.TestSetOnce"/> class.
 /// </summary>
 public TestSetOnce()
 {
     nb = new SetOnce <int>();
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Coinche.Server.Lobby"/> class.
 /// </summary>
 /// <param name="name">Name.</param>
 public Lobby(string name)
 {
     _name        = name;
     _connections = new List <Connection>();
     _isStarted   = new SetOnce <bool>();
 }