public ShippingCostService(
			IRepository<ShippingDistanceCost> repo, 
			IDistanceCalculator distanceCalculator)
        {
            _repo = repo;
            _distanceCalculator = distanceCalculator;
        }
Exemplo n.º 2
0
 public UserMover(IUserRetriever userRetriever, IUserEnergyCalculator userEnergyCalculator, IUserSaver userSaver, IDistanceCalculator distanceCalculator)
 {
     _userRetriever = userRetriever;
     _userEnergyCalcualtor = userEnergyCalculator;
     _userSaver = userSaver;
     _distanceCalculator = distanceCalculator;
 }
 public UserMoveDirector(IUserRetriever userRetriever, IUserEnergyProvider userEnergyCalculator, IUserSaver userSaver, IDistanceCalculator distanceCalculator, IUserCountsSaver userCountsSaver)
 {
     _userRetriever = userRetriever;
     _userEnergyCalcualtor = userEnergyCalculator;
     _userSaver = userSaver;
     _distanceCalculator = distanceCalculator;
     _userCountsSaver = userCountsSaver;
 }
            public CachedDistanceFunctionValue(AtomicReader reader, ShapeFieldCacheDistanceValueSource enclosingInstance)
            {
                cache = enclosingInstance.provider.GetCache(reader);
                this.enclosingInstance = enclosingInstance;

                from = enclosingInstance.from;
                calculator = enclosingInstance.ctx.DistCalc;
                nullValue = (enclosingInstance.ctx.IsGeo ? 180 * enclosingInstance.multiplier : double.MaxValue);
            }
        private readonly double nullValue;//computed

        public DistanceToShapeValueSource(ValueSource shapeValueSource, IPoint queryPoint,
                                          double multiplier, SpatialContext ctx)
        {
            this.shapeValueSource = shapeValueSource;
            this.queryPoint = queryPoint;
            this.multiplier = multiplier;
            this.distCalc = ctx.DistCalc;
            this.nullValue =
                (ctx.IsGeo ? 180 * multiplier : double.MaxValue);
        }
Exemplo n.º 6
0
        public TimeTrackerWorkspace(IDistanceCalculator distanceCalculator)
        {
            this.distanceCalculator = distanceCalculator;

            // set the db location
            //databaseLocation = Path.Combine (NSBundle.MainBundle.BundlePath, "Library/TrackLocationDB.db3");
            this.databaseLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "LocationsDb.db3");

            // instantiate the database
            this.database = new TimeTrackerDatabase(this.databaseLocation);
        }
Exemplo n.º 7
0
        public IRace Create(IDistanceCalculator distanceCalculator, IEnumerable<Waypoint> waypoints)
        {
          
                distanceCalculator.AssertNotNull();
                waypoints = waypoints as List<Waypoint> ?? waypoints.ToList();
                waypoints.AssertNotEmpty();
                waypoints.AssertNotNull();

                var Race = new RaceService(distanceCalculator, waypoints);
                return Race;
  
            
        }
 public ClassificationService(
     IImageBinarizer imageBinarizer, 
     IImageProcessor imageProcessor,
     ILabelingService labelingService,
     IDistanceCalculator<ClassificationUnit> distanceCalculator,
     int classNumber)
 {
     this._imageBinarizer = imageBinarizer;
     this._imageProcessor = imageProcessor;
     this._labelingService = labelingService;
     this._polygons = new List<Polygon>();
     this._classificationUnits = new List<ClassificationUnit>();
     this._distanceCalculator = distanceCalculator;
     this._classNumber = classNumber;
     this._random = new RNGCryptoServiceProvider();
     this._kernels = new List<Kernel>(this._classNumber);
 }
        public UsersController()
        {
            _zombiePackRetriever = MvcApplication.DependancyInjection.Resolve<IZombiePackRetriever>();
            _hotZoneRetriever = MvcApplication.DependancyInjection.Resolve<IHotZoneRetriever>();
            _userRetriever = MvcApplication.DependancyInjection.Resolve<IUserRetriever>();
            _userSaver = MvcApplication.DependancyInjection.Resolve<IUserSaver>();
            _userHotZoneProgressRetriever = MvcApplication.DependancyInjection.Resolve<IUserZombiePackProgressRetriever>();
            _userItemRetriever = MvcApplication.DependancyInjection.Resolve<IUserItemRetriever>();

            _distanceCalculator = MvcApplication.DependancyInjection.Resolve<IDistanceCalculator>();
            _userEnergyProvider = MvcApplication.DependancyInjection.Resolve<IUserEnergyProvider>();
            _userMover = MvcApplication.DependancyInjection.Resolve<IUserMoveDirector>();
            _shopDirector = MvcApplication.DependancyInjection.Resolve<IShopDirector>();
            _userAttackPowerProvider = MvcApplication.DependancyInjection.Resolve<IUserAttackPowerProvider>();
            _userSightRadiusProvider = MvcApplication.DependancyInjection.Resolve<IUserSightRadiusProvider>();
            _itemUsageDirector = MvcApplication.DependancyInjection.Resolve<IItemUsageDirector>();
            _achievementProvider = MvcApplication.DependancyInjection.Resolve<IAchievementProvider>();
            _userLevelService = MvcApplication.DependancyInjection.Resolve<IUserLevelService>();
            _userCountsRetriever = MvcApplication.DependancyInjection.Resolve<IUserCountsRetriever>();
        }
Exemplo n.º 10
0
        public void TestInitialize()
        {
            _loader = new RailNetworkDataLoader(Input);

            _distanceCalculator = DistanceCalculator<RailNetwork, City, Route>.Create(_loader);
        }
Exemplo n.º 11
0
 public void TestCleanup()
 {
     _loader = null;
     _distanceCalculator = null;
 }
Exemplo n.º 12
0
        private bool RedrawGraph()
        {
            try
            {
                panel1.Controls.Clear();
                using (var graphics = panel1.CreateGraphics())
                {
                    graphics.Clear(Color.White);
                    graphics.SmoothingMode = SmoothingMode.AntiAlias;
                }

                var loader = new RailNetworkDataLoader(textBox1.Text);
                _distanceCalculator = DistanceCalculator<RailNetwork, City, Route>.Create(loader);

                var nodes = _distanceCalculator.Graph.Nodes.Values.ToList();

                DrawNodes(nodes);

                DrawEdges(nodes);

                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Invalid Graph\r\n" + ex);
                return false;
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Dispose field instances.
 /// </summary>
 /// <param name="disposeManaged">If disposeManaged equals true, clean all resources.</param>
 protected virtual void Dispose(bool disposeManaged)
 {
     if (disposeManaged)
     {
         this.distanceCalculator = null;
         this.mapPairedReads = null;
         this.pairedReadFilter = null;
         this.pathAssembler = null;
         this.readContigMap = null;
         this.tracePath = null;
     }
 }
 public void Setup()
 {
     _calculator = new DistanceCalculator();
 }
 public when_calculating_distance()
 {
     _distanceCalculator = new DistanceCalculator();
 }
Exemplo n.º 16
0
            public DistanceFunctionValue(DistanceValueSource outerInstance, AtomicReader reader)
            {
                this.outerInstance = outerInstance;

                ptX = FieldCache.DEFAULT.GetDoubles(reader, outerInstance.strategy.FieldNameX, true);
                ptY = FieldCache.DEFAULT.GetDoubles(reader, outerInstance.strategy.FieldNameY, true);
                validX = FieldCache.DEFAULT.GetDocsWithField(reader, outerInstance.strategy.FieldNameX);
                validY = FieldCache.DEFAULT.GetDocsWithField(reader, outerInstance.strategy.FieldNameY);

                from = outerInstance.from;
                calculator = outerInstance.strategy.SpatialContext.DistCalc;
                nullValue = (outerInstance.strategy.SpatialContext.IsGeo ? 180 * outerInstance.multiplier : double.MaxValue);
            }
 public AverageDailyDistanceCalculator(IDistanceCalculator calculator, DateRange period, VisitsByDayLINQQuery query)
 {
     this.calculator = calculator;
     this.period = period;
     this.query = query;
 }
 public CentroidDistanceGenerator(IDistanceCalculator calculator)
 {
     this.calculator = calculator;
 }
 public StoreRepository(string connectionString, IDistanceCalculator distanceCalculator)
 {
     _connectionString = connectionString;
     _distanceCalculator = distanceCalculator;
 }
Exemplo n.º 20
0
 public MatrixGenerator(IDistanceCalculator calculator)
 {
     this.calculator = calculator;
 }
Exemplo n.º 21
0
 public ClassificationUnit WithDistanceDalculator(IDistanceCalculator<ClassificationUnit> distanceCalculator)
 {
     this._distanceCalculator = distanceCalculator;
     return this;
 }
Exemplo n.º 22
0
 public RaceService(IDistanceCalculator distanceCalculator, IEnumerable<Waypoint> waypoints)
 {
     DistanceCalculator = distanceCalculator;
     Waypoints = waypoints;
 }
 public ZombiePackRepository(string connectionString, IDistanceCalculator distanceCalculator)
 {
     _connectionString = connectionString;
     _distanceCalculator = distanceCalculator;
 }
 public BaseRouteCreator(IDistanceCalculator distanceCalculator)
 {
     _distanceCalculator = distanceCalculator;
 }
 public GpxRouteCreator(IDistanceCalculator distanceCalculator) : base(distanceCalculator)
 {
     
 }
Exemplo n.º 26
0
        public void DijkstraInstantiation_ValidCityData()
        {
            _loader = new RailNetworkDataLoader("AB5");
            _distanceCalculator = DistanceCalculator<RailNetwork, City, Route>.Create(_loader);

            Assert.AreEqual(2, _distanceCalculator.Graph.NodeCount);

            Assert.AreEqual(1, _distanceCalculator.Graph.EdgeCount);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Calculate distance between contigs using paired reads.
        /// </summary>
        /// <param name="contigMatePairs">Contig Mate Pair map.</param>
        /// <returns>Number of contig-read pairs.</returns>
        protected int CalculateDistanceBetweenContigs(ContigMatePairs contigMatePairs)
        {
            if (contigMatePairs == null)
            {
                throw new ArgumentNullException("contigMatePairs");
            }

            if (this.distanceCalculator == null)
            {
                this.distanceCalculator = new DistanceCalculator(contigMatePairs);
                contigMatePairs = this.distanceCalculator.CalculateDistance();
            }
            else
            {
                contigMatePairs = this.distanceCalculator.CalculateDistance();
            }

            // this dictionary is updated in this step.
            return contigMatePairs.Count;
        }
Exemplo n.º 28
0
        public void DijkstraInstantiation_ValidCityDataWithRepeatingRoutes()
        {
            _loader = new RailNetworkDataLoader("AB5,BC6,CD7,BC6,BC6");
            _distanceCalculator = DistanceCalculator<RailNetwork, City, Route>.Create(_loader);

            Assert.AreEqual(4, _distanceCalculator.Graph.NodeCount);

            Assert.AreEqual(3, _distanceCalculator.Graph.EdgeCount);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Initializes a new instance of the GraphScaffoldBuilder class.
        /// </summary>
        /// <param name="mapPairedReads">Mapping reads to mate pairs.</param>
        /// <param name="readContigMap"> Mapping reads to contigs.</param>
        /// <param name="pairedReadFilter">Filtering of mate pairs.</param>
        /// <param name="distanceCalculator">Calculation of distance between 
        /// contigs using mate pairs.</param>
        /// <param name="tracePath">Traversal of contig overlap graph.</param>
        /// <param name="pathAssembler">Removal of containing paths and removal of overlapping paths.</param>
        public GraphScaffoldBuilder(
            IMatePairMapper mapPairedReads,
            IReadContigMapper readContigMap,
            IOrientationBasedMatePairFilter pairedReadFilter,
            IDistanceCalculator distanceCalculator,
            ITracePath tracePath,
            IPathPurger pathAssembler)
        {
            this.mapPairedReads = mapPairedReads ?? new MatePairMapper();
            this.readContigMap = readContigMap ?? new ReadContigMapper();
            this.pairedReadFilter = pairedReadFilter ?? new OrientationBasedMatePairFilter();
            this.tracePath = tracePath ?? new TracePath();
            this.pathAssembler = pathAssembler ?? new PathPurger();

            if (null != distanceCalculator)
            {
                this.distanceCalculator = distanceCalculator;
            }

            //Hierarchical Scaffolding With Bambus
            //by: Mihai Pop, Daniel S. Kosack, Steven L. Salzberg
            //Genome Research, Vol. 14, No. 1. (January 2004), pp. 149-159.
            this.redundancyField = 2;

            //Memory and performance optimization.
            this.depthField = 10;
        }
Exemplo n.º 30
0
 /// <summary>
 /// Initializes static class
 /// </summary>
 static Calculations()
 {
     _distanceCalculator = new GreatCircleDistanceCalculator();
 }