void SetupEngine(PatternType ptyp) { switch (ptyp) { case PatternType.barrel: _pathEngine = new OffsetPathEngine(); break; case PatternType.bazley: _pathEngine = new BazelyEngine(); break; case PatternType.ross: _pathEngine = new RossEngine(); break; case PatternType.wheels: _pathEngine = new WheelsEngine(); break; case PatternType.latticeRim: _pathEngine = new LatticeRimEngine(); break; case PatternType.latticeFace: _pathEngine = new LatticeFaceEngine(); break; case PatternType.braid: _pathEngine = new BraidEngine(); break; } }
public McEngine(IRandomGenerator randomGenerator, IPathGenerator <TPath> pathGenerator, IPathResultAgregator <TPath, TResult> pathResultAggregator) { this.randomGenerator = randomGenerator; this.pathGenerator = pathGenerator; this.pathResultAggregator = pathResultAggregator; }
public ReplyController(IReplyService replyService, IPathGenerator pathGenerator, IFileStorage fileStorage, IStorageService storageService) { _replyService = replyService; _pathGenerator = pathGenerator; _fileStorage = fileStorage; _storageService = storageService; }
public TempFileManager(string tempDirectory = null) { if (string.IsNullOrEmpty(tempDirectory)) { newPathGenerator = new DefaultPathGenerator(); } else { newPathGenerator = new CustomPathGenerator(tempDirectory); } }
public TicketController( ITicketService ticketService, IPathGenerator pathGenerator, IFileStorage fileStorage, IStorageService storageService) { _ticketService = ticketService; _pathGenerator = pathGenerator; _fileStorage = fileStorage; _storageService = storageService; }
/// <summary> /// Need to /// Set CurrentPaths to null /// Set CurrentPathData to null /// Set MaxPathRadius to ZERO /// </summary> public void CleanUpForPageChange(bool clearCurrentPath) { if (clearCurrentPath) { CurrentPath = null; SaveCurrentPathdata(); CurrentPathData = null; } SelectedPathIndex = -1; _pathEngine = null; }
public FileSystemLoader() { //LocationFolder = @"C:\Users\Uros\Downloads\IV godina\VII semestar\Arhitektura i projektovanje softvera\Projekat\Newsman\Baza\Slike\"; pathgen = new IIExpresPath(); string path = Directory.GetCurrentDirectory(); for (int i = 0; i < 4; i++) { path = Path.GetDirectoryName(path); } path += "\\Slike\\"; LocationFolder = path; }
public Renamer() { this.logger = new Logger(); this.settings = new Settings(logger); this.fileSearcher = new FileSearcher(settings, logger); this.movieFileBot = new FileBot(settings, logger, true); this.seriesFileBot = new FileBot(settings, logger, false); this.cleaner = new Cleaner(settings, fileSearcher, logger); this.pathGenerator = new PathGenerator(); this.fileMover = new FileMover(logger); this.cleaner = new Cleaner(settings, fileSearcher, logger); this.archiver = new Archiver(settings, fileMover); }
//! basic calculate method provided to inherited pricing engines public void calculate(double requiredTolerance, int requiredSamples, int maxSamples) { if (!(requiredTolerance != 0 || requiredSamples != 0)) { throw new ApplicationException("neither tolerance nor number of samples set"); } //! Initialize the one-factor Monte Carlo if (this.controlVariate_) { double controlVariateValue = this.controlVariateValue(); if (controlVariateValue == 0) { throw new ApplicationException("engine does not provide control-variation price"); } PathPricer <IPath> controlPP = this.controlPathPricer(); if (controlPP == null) { throw new ApplicationException("engine does not provide control-variation path pricer"); } IPathGenerator <IRNG> controlPG = this.controlPathGenerator(); this.mcModel_ = new MonteCarloModel <MC, RNG, S>(pathGenerator(), pathPricer(), new S(), antitheticVariate_, controlPP, controlVariateValue, controlPG); } else { this.mcModel_ = new MonteCarloModel <MC, RNG, S>(pathGenerator(), pathPricer(), new S(), antitheticVariate_); } if (requiredTolerance != 0) { if (maxSamples != 0) { value(requiredTolerance, maxSamples); } else { value(requiredTolerance); } } else { valueWithSamples(requiredSamples); } }
public MonteCarloModel(IPathGenerator <IRNG> pathGenerator, PathPricer <IPath> pathPricer, S sampleAccumulator, bool antitheticVariate, PathPricer <IPath> cvPathPricer = null, double cvOptionValue = 0, IPathGenerator <IRNG> cvPathGenerator = null) { pathGenerator_ = pathGenerator; pathPricer_ = pathPricer; sampleAccumulator_ = sampleAccumulator; isAntitheticVariate_ = antitheticVariate; cvPathPricer_ = cvPathPricer; cvOptionValue_ = cvOptionValue; cvPathGenerator_ = cvPathGenerator; if (cvPathPricer_ == null) { isControlVariate_ = false; } else { isControlVariate_ = true; } }
//! basic calculate method provided to inherited pricing engines public void calculate(double?requiredTolerance, int?requiredSamples, int?maxSamples) { Utils.QL_REQUIRE(requiredTolerance != null || requiredSamples != null, () => "neither tolerance nor number of samples set"); //! Initialize the one-factor Monte Carlo if (this.controlVariate_) { double?controlVariateValue = this.controlVariateValue(); Utils.QL_REQUIRE(controlVariateValue != null, () => "engine does not provide control-variation price"); PathPricer <IPath> controlPP = this.controlPathPricer(); Utils.QL_REQUIRE(controlPP != null, () => "engine does not provide control-variation path pricer"); IPathGenerator <IRNG> controlPG = this.controlPathGenerator(); this.mcModel_ = new MonteCarloModel <MC, RNG, S>(pathGenerator(), pathPricer(), FastActivator <S> .Create(), antitheticVariate_, controlPP, controlVariateValue.GetValueOrDefault(), controlPG); } else { this.mcModel_ = new MonteCarloModel <MC, RNG, S>(pathGenerator(), pathPricer(), FastActivator <S> .Create(), antitheticVariate_); } if (requiredTolerance != null) { if (maxSamples != null) { value(requiredTolerance.Value, maxSamples.Value); } else { value(requiredTolerance.Value); } } else { valueWithSamples(requiredSamples.GetValueOrDefault()); } }
/// <summary> /// 初始化本地文件存储服务 /// </summary> /// <param name="pathGenerator">路径生成器</param> public DefaultFileStore(IPathGenerator pathGenerator) { _generator = pathGenerator; }
public Simulation(IPathGenerator pathGenerator, IMapPrinter mapPrinter) { _pathGenerator = pathGenerator; _mapPritner = mapPrinter; }
/// <summary> /// 初始化测试 /// </summary> public DefaultPathGeneratorTest() { _generator = new DefaultPathGenerator(@"c:\", new StubRandomGenerator()); }
/// <summary> /// 初始化测试 /// </summary> public DefaultPathGeneratorTest() { _generator = new DefaultPathGenerator(new DefaultBasePath(@"b"), new StubRandomGenerator()); Time.SetTime("2000-1-1 10:11:12"); }
public MapGenerator([NotNull] IPathGenerator pathGenerator) { _pathGenerator = pathGenerator ?? throw new ArgumentNullException(nameof(pathGenerator)); }
/// <summary> /// 初始化一个<see cref="DefaultFileStore"/>类型的实例 /// </summary> /// <param name="pathGenerator">路径生成器</param> public DefaultFileStore(IPathGenerator pathGenerator) => _pathGenerator = pathGenerator;
public PathService(IPathGenerator pathGenerator) { _pathGenerator = pathGenerator ?? throw new ArgumentNullException(nameof(pathGenerator)); }
public FilesController(IFileStorage fileStorage, IStorageValidation storageValidation, IPathGenerator pathGenerator) { _fileStorage = fileStorage; _storageValidation = storageValidation; _pathGenerator = pathGenerator; }