Exemple #1
0
        // O(n)
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            var result = new List <IEntity>();

            foreach (var value in this._entities)
            {
                var list = value.Value;
                if (list.Count > 1)
                {
                    foreach (var v in list)
                    {
                        if (v.Status >= lowerBound && v.Status <= upperBound)
                        {
                            result.Add(v);
                        }
                    }
                }
                else
                {
                    if (list[0].Status >= lowerBound && list[0].Status <= upperBound)
                    {
                        result.Add(list[0]);
                    }
                }
            }

            return(result);
        }
Exemple #2
0
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     foreach (var item in entities)
     {
         if (item.Status == oldStatus)
         {
             item.Status = newStatus;
         }
     }
 }
Exemple #3
0
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     for (int i = 0; i < this.EntitiesCount; i++)
     {
         if (this._elements[i].Status == oldStatus)
         {
             this._elements[i].Status = newStatus;
         }
     }
 }
Exemple #4
0
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     foreach (var item in this.entities)
     {
         if ((BaseEntityStatus)item.Status == (BaseEntityStatus)oldStatus)
         {
             item.Status = (BaseEntityStatus)newStatus;
         }
     }
 }
Exemple #5
0
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     this.entities.ForEach(entity =>
     {
         if (entity.Status == oldStatus)
         {
             entity.Status = newStatus;
         }
     });
 }
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     foreach (var entity in this._entities)
     {
         if (entity.Status == oldStatus)
         {
             entity.Status = newStatus;
         }
     }
 }
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     for (int i = 0; i < this.EntitiesCount; i++)
     {
         var current = this._entities[i];
         if (current.Status == oldStatus)
         {
             current.Status = newStatus;
         }
     }
 }
Exemple #8
0
 private bool IsStatusInRange(BaseEntityStatus status,
                              int lower, int upper)
 {
     if ((int)status < lower)
     {
         return(false);
     }
     if ((int)status > upper)
     {
         return(false);
     }
     return(true);
 }
Exemple #9
0
 // O(n)
 public void UpdateAll(BaseEntityStatus oldStatus, BaseEntityStatus newStatus)
 {
     foreach (var kvp in this._entities.Values)
     {
         foreach (var item in kvp)
         {
             if (item.Status == oldStatus)
             {
                 item.Status = newStatus;
             }
         }
     }
 }
Exemple #10
0
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            var result = new List <IEntity>();

            foreach (var entity in this.entities)
            {
                if (entity.Status >= lowerBound && entity.Status <= upperBound)
                {
                    result.Add(entity);
                }
            }

            return(result);
        }
Exemple #11
0
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            List <IEntity> list = new List <IEntity>();

            foreach (var item in entities)
            {
                if (item.Status >= lowerBound && item.Status <= upperBound)
                {
                    list.Add(item);
                }
            }

            return(list);
        }
Exemple #12
0
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            var result = new List <IEntity>();

            for (int i = 0; i < this.EntitiesCount; i++)
            {
                if (this._elements[i].Status >= lowerBound &&
                    this._elements[i].Status <= upperBound)
                {
                    result.Add(this._elements[i]);
                }
            }

            return(result);
        }
Exemple #13
0
        public List <IEntity> RetainAllFromTo
            (BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            int lower = (int)lowerBound;
            int upper = (int)upperBound;
            var list  = new List <IEntity>(this.EntitiesCount);

            foreach (var entity in entities)
            {
                if (IsStatusInRange(entity.Status, lower, upper))
                {
                    list.Add(entity);
                }
            }
            return(list);
        }
Exemple #14
0
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            int lowerBoundIndex = (int)lowerBound;
            int upperBoundIndex = (int)upperBound;

            var result = new List <IEntity>(this.EntitiesCount);

            foreach (var item in items)
            {
                int statusNumber = (int)item.Status;
                if (lowerBoundIndex <= statusNumber &&
                    statusNumber <= upperBoundIndex)
                {
                    result.Add(item);
                }
            }
            return(result);
        }
Exemple #15
0
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            List <IEntity> result          = new List <IEntity>();
            int            lowerBoundAsNum = (int)lowerBound;
            int            upperBoundAsNum = (int)upperBound;

            for (int i = 0; i < this.EntitiesCount; i++)
            {
                IEntity currentEntity            = this._entities[i];
                int     currentEntityStatusAsNum = (int)currentEntity.Status;

                if (currentEntityStatusAsNum >= lowerBoundAsNum && currentEntityStatusAsNum <= upperBoundAsNum)
                {
                    result.Add(currentEntity);
                }
            }

            return(result);
        }
        public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
        {
            var result          = new List <IEntity>(this.EntitiesCount);
            int lowerBoundIndex = (int)lowerBound;
            int upperBoundIndex = (int)upperBound;

            for (int i = 0; i < this.EntitiesCount; i++)
            {
                var entity            = this._entities[i];
                int entityStatusIndex = (int)entity.Status;

                if (entityStatusIndex >= lowerBoundIndex && entityStatusIndex <= upperBoundIndex)
                {
                    result.Add(entity);
                }
            }

            return(result);
        }
 public List <IEntity> RetainAllFromTo(BaseEntityStatus lowerBound, BaseEntityStatus upperBound)
 {
     return(_entities.Where(x => x.Status >= lowerBound && x.Status <= upperBound).ToList());
 }