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); } }
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); } } }
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)); }
/// <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; }
public virtual void TestEmptyCtor() { SetOnce<int?> set = new SetOnce<int?>(); Assert.IsNull(set.Get()); }
/// <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; }
/// <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; }
/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="T:Server.UtilsTest.TestSetOnce"/> class. /// </summary> public TestSetOnce() { nb = new SetOnce <int>(); }
/// <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>(); }