Esempio n. 1
0
        public void Test_Construct(int eNodebId, byte sectorId, bool outdoor, string indoor,
                                   double height, double eTilt, double mTilt, int tac)
        {
            var cell = new Cell
            {
                ENodebId  = eNodebId,
                SectorId  = sectorId,
                IsOutdoor = outdoor,
                Height    = height,
                ETilt     = eTilt,
                MTilt     = mTilt,
                Tac       = tac
            };
            var view = CellView.ConstructView(cell, _repository.Object);

            if (eNodebId > 0 && eNodebId <= 3)
            {
                Assert.AreEqual(view.ENodebName, "ENodeb-" + eNodebId);
            }
            else
            {
                Assert.IsNull(view.ENodebName);
            }
            Assert.AreEqual(view.ENodebId, eNodebId);
            Assert.AreEqual(view.SectorId, sectorId);
            Assert.AreEqual(view.Indoor, indoor);
            Assert.AreEqual(view.Height, height);
            Assert.AreEqual(view.DownTilt, eTilt + mTilt);
            Assert.AreEqual(view.Tac, tac);
        }
Esempio n. 2
0
        public IEnumerable <SectorView> QuerySectors(SectorRangeContainer container)
        {
            var cells =
                _repository.GetAllList(container.West, container.East, container.South, container.North)
                .Where(x => x.IsInUse).ToList();

            if (container.ExcludedCells.Any())
            {
                var excludeCells = from cell in cells
                                   join sector in container.ExcludedCells on new
                {
                    CellId = cell.ENodebId,
                    cell.SectorId
                } equals new
                {
                    sector.CellId,
                    sector.SectorId
                }
                select cell;
                cells = cells.Except(excludeCells).ToList();
            }

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Esempio n. 3
0
        public IEnumerable <CellView> GetCellViews(int eNodebId)
        {
            var cells = _repository.GetAllList(eNodebId);

            return(cells.Any()
                ? cells.Select(x => CellView.ConstructView(x, _eNodebRepository))
                : new List <CellView>());
        }
Esempio n. 4
0
        public IEnumerable <SectorView> QuerySectors(double west, double east, double south, double north)
        {
            var cells = _repository.GetAllList(west, east, south, north);

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Esempio n. 5
0
        public IEnumerable <SectorView> QuerySectors(int eNodebId)
        {
            var cells = _repository.GetAllList(eNodebId);

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Esempio n. 6
0
        public IEnumerable <CellView> QueryByRruName(string rruName)
        {
            var rrus = _rruRepository.GetAllList(x => x.RruName.Contains(rruName));

            return(from rru in rrus
                   select _repository.FirstOrDefault(x => x.ENodebId == rru.ENodebId && x.LocalSectorId == rru.LocalSectorId)
                   into cell where cell != null
                   select CellView.ConstructView(cell, _eNodebRepository));
        }
Esempio n. 7
0
        public IEnumerable <SectorView> QuerySectorsInUse(int eNodebId)
        {
            var cells = _repository.GetAllInUseList().Where(x => x.ENodebId == eNodebId).ToList();

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Esempio n. 8
0
        public IEnumerable <CellView> GetViews(string collegeName)
        {
            var ids   = _repository.GetCellIds(collegeName);
            var query = ids.Select(_cellRepository.Get).Where(cell => cell != null).ToList();

            return(query.Any()
                ? query.Select(x => CellView.ConstructView(x, _eNodebRepository))
                : null);
        }
Esempio n. 9
0
        public IEnumerable <SectorView> QuerySectors(IEnumerable <string> collegeNames)
        {
            var ids   = collegeNames.Select(x => _repository.GetCellIds(x)).Aggregate((x, y) => x.Concat(y)).Distinct();
            var query = ids.Select(_cellRepository.Get).Where(cell => cell != null).ToList();

            return(query.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       query.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : null);
        }
Esempio n. 10
0
        public IEnumerable <CellView> GetNearbyCellsWithPci(int eNodebId, byte sectorId, short pci)
        {
            var cell = _repository.GetBySectorId(eNodebId, sectorId);

            if (cell == null)
            {
                return(new List <CellView>());
            }
            return
                (GetCells(cell.Longtitute - 0.2, cell.Longtitute + 0.2, cell.Lattitute - 0.2, cell.Lattitute + 0.2)
                 .Where(x => x.Pci == pci && sectorId < x.SectorId + 16 && x.SectorId < sectorId + 16)
                 .Select(x => CellView.ConstructView(x, _eNodebRepository)));
        }
Esempio n. 11
0
        public IEnumerable <SectorView> GetCells(double west, double east, double south, double north)
        {
            var cells = _repository.GetAllList(x =>
                                               x.Longtitute >= west &&
                                               x.Longtitute <= east &&
                                               x.Lattitute >= south &&
                                               x.Lattitute <= north && x.IsInUse);

            return(cells.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       cells.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : new List <SectorView>());
        }
Esempio n. 12
0
        public IEnumerable <SectorView> QueryHotSpotSectors(string name)
        {
            var ids =
                _repository.GetAllList(
                    x => x.HotspotName == name && x.InfrastructureType == InfrastructureType.Cell);
            var query =
                ids.Select(x => _cellRepository.GetBySectorId(x.ENodebId, x.SectorId))
                .Where(cell => cell != null)
                .ToList();

            return(query.Any()
                ? Mapper.Map <IEnumerable <CellView>, IEnumerable <SectorView> >(
                       query.Select(x => CellView.ConstructView(x, _eNodebRepository)))
                : null);
        }
Esempio n. 13
0
        public CellView GetCell(int eNodebId, byte sectorId)
        {
            var cell = _repository.GetBySectorId(eNodebId, sectorId);

            return(cell == null ? null : CellView.ConstructView(cell, _eNodebRepository));
        }