Ejemplo n.º 1
0
        internal void Update(GameTime gameTime)
        {
            if (isClear)
            {
                return;
            }
            if (collectionsToUpdate.Count > 0)
            {
                CollectionUtils.Clear(collectionsToUpdate);
            }
            foreach (IGameComponent drawable  in  collections)
            {
                CollectionUtils.Add(collectionsToUpdate, drawable);
            }
            IGameComponent _drawable;
            int            screenIndex;

            for (; collectionsToUpdate.Count > 0;)
            {
                screenIndex = collectionsToUpdate.Count - 1;
                _drawable   = collectionsToUpdate[screenIndex];

                CollectionUtils.RemoveAt(collectionsToUpdate, screenIndex);

                if (_drawable is IUpdateable)
                {
                    IUpdateable comp = (IUpdateable)_drawable;
                    comp.Update(gameTime);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Filter remaining keys using an IDictionary of available indexes.
        /// </summary>
        /// <remarks>
        /// The filter is responsible for removing all keys from the passed
        /// set of keys that the applicable indexes can prove should be
        /// filtered. If the filter does not fully evaluate the remaining
        /// keys using just the index information, it must return a filter
        /// (which may be an <see cref="IEntryFilter"/>) that can complete the
        /// task using an iterating implementation. If, on the other hand, the
        /// filter does fully evaluate the remaining keys using just the index
        /// information, then it should return <c>null</c> to indicate that no
        /// further filtering is necessary.
        /// </remarks>
        /// <param name="indexes">
        /// The available <see cref="ICacheIndex"/> objects keyed by the
        /// related IValueExtractor; read-only.
        /// </param>
        /// <param name="keys">
        /// The mutable set of keys that remain to be filtered.
        /// </param>
        /// <returns>
        /// An <see cref="IFilter"/> object that can be used to process the
        /// remaining keys, or <c>null</c> if no additional filter processing
        /// is necessary.
        /// </returns>
        public IFilter ApplyIndex(IDictionary indexes, ICollection keys)
        {
            var index = (ICacheIndex)indexes[ValueExtractor];

            if (index == null)
            {
                // there is no relevant index
                return(this);
            }

            foreach (object oValue in (ICollection)Value)
            {
                var colEQ = (ICollection)index.IndexContents[oValue];
                if (colEQ == null)
                {
                    CollectionUtils.Clear(keys);
                    break;
                }
                CollectionUtils.RetainAll(keys, colEQ);
                if (keys.Count == 0)
                {
                    break;
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
 public void Clear()
 {
     lock (barCaches)
     {
         CollectionUtils.Clear(barCaches);
     }
 }
Ejemplo n.º 4
0
        public void Commits()
        {
            bool changes       = false;
            int  additionCount = pendingAdd.Count;

            if (additionCount > 0)
            {
                for (int i = 0; i < additionCount; i++)
                {
                    Gravity obj0 = (Gravity)pendingAdd[i];
                    CollectionUtils.Add(objects, obj0);
                }
                CollectionUtils.Clear(pendingAdd);
                changes = true;
            }
            int removalCount = pendingRemove.Count;

            if (removalCount > 0)
            {
                for (int i_0 = 0; i_0 < removalCount; i_0++)
                {
                    Gravity object_1 = (Gravity)pendingRemove[i_0];
                    CollectionUtils.Remove(objects, object_1);
                }
                CollectionUtils.Clear(pendingRemove);
                changes = true;
            }
            if (changes)
            {
                lazyObjects = objects.ToArray();
            }
        }
Ejemplo n.º 5
0
        public List <Vector2f> Neighbors(Vector2f pos, bool flag)
        {
            if (result == null)
            {
                result = new List <Vector2f>(8);
            }
            else
            {
                CollectionUtils.Clear(result);
            }
            int x = pos.X();
            int y = pos.Y();

            CollectionUtils.Add(result, new Vector2f(x, y - 1));
            CollectionUtils.Add(result, new Vector2f(x + 1, y));
            CollectionUtils.Add(result, new Vector2f(x, y + 1));
            CollectionUtils.Add(result, new Vector2f(x - 1, y));
            if (flag)
            {
                CollectionUtils.Add(result, new Vector2f(x - 1, y - 1));
                CollectionUtils.Add(result, new Vector2f(x + 1, y - 1));
                CollectionUtils.Add(result, new Vector2f(x + 1, y + 1));
                CollectionUtils.Add(result, new Vector2f(x - 1, y + 1));
            }
            return(result);
        }
Ejemplo n.º 6
0
 public void Dispose()
 {
     if (_fsList != null)
     {
         CollectionUtils.Clear(_fsList);
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Filter remaining keys using an IDictionary of available indexes.
        /// </summary>
        /// <remarks>
        /// The filter is responsible for removing all keys from the passed
        /// set of keys that the applicable indexes can prove should be
        /// filtered. If the filter does not fully evaluate the remaining
        /// keys using just the index information, it must return a filter
        /// (which may be an <see cref="IEntryFilter"/>) that can complete the
        /// task using an iterating implementation. If, on the other hand, the
        /// filter does fully evaluate the remaining keys using just the index
        /// information, then it should return <c>null</c> to indicate that no
        /// further filtering is necessary.
        /// </remarks>
        /// <param name="indexes">
        /// The available <see cref="ICacheIndex"/> objects keyed by the
        /// related IValueExtractor; read-only.
        /// </param>
        /// <param name="keys">
        /// The mutable set of keys that remain to be filtered.
        /// </param>
        /// <returns>
        /// An <see cref="IFilter"/> object that can be used to process the
        /// remaining keys, or <c>null</c> if no additional filter processing
        /// is necessary.
        /// </returns>
        public IFilter ApplyIndex(IDictionary indexes, ICollection keys)
        {
            var index = (ICacheIndex)indexes[ValueExtractor];

            if (index == null)
            {
                // there is no relevant index
                return(this);
            }

            var values = (ICollection)Value;
            var setIn  = new HashSet();

            foreach (object value in values)
            {
                var colEQ = (ICollection)index.IndexContents[value];
                if (colEQ != null)
                {
                    CollectionUtils.AddAll(setIn, colEQ);
                }
            }

            if (setIn.Count == 0)
            {
                CollectionUtils.Clear(keys);
            }
            else
            {
                CollectionUtils.RetainAll(keys, setIn);
            }
            return(null);
        }
Ejemplo n.º 8
0
 public virtual void Dispose()
 {
     this.isEnabled = false;
     if (objects != null)
     {
         CollectionUtils.Clear(objects);
         objects = null;
     }
     if (pendingAdd != null)
     {
         CollectionUtils.Clear(pendingAdd);
         pendingAdd = null;
     }
     if (pendingAdd != null)
     {
         CollectionUtils.Clear(pendingAdd);
         pendingAdd = null;
     }
     if (lazyObjects != null)
     {
         foreach (Gravity g in lazyObjects)
         {
             if (g != null)
             {
                 g.Dispose();
             }
         }
     }
 }
Ejemplo n.º 9
0
        public override void Draw(GLEx g)
        {
            if (IsOnLoadComplete())
            {
                batch.Begin();

                gameCollection.Draw(batch, gameTime);
                if (drawablesToDraw.Count > 0)
                {
                    CollectionUtils.Clear(drawablesToDraw);
                }

                foreach (Drawable drawable in drawables)
                {
                    CollectionUtils.Add(drawablesToDraw, drawable);
                }

                foreach (Drawable drawable in drawablesToDraw)
                {
                    if (drawable._enabled)
                    {
                        if (drawable.GetDrawableState() == Painting.DrawableState.Hidden)
                        {
                            continue;
                        }
                        drawable.Draw(batch, gameTime);
                    }
                }
                Draw(batch);
                batch.End();
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Filter remaining keys using an IDictionary of available indexes.
        /// </summary>
        /// <remarks>
        /// The filter is responsible for removing all keys from the passed
        /// set of keys that the applicable indexes can prove should be
        /// filtered. If the filter does not fully evaluate the remaining
        /// keys using just the index information, it must return a filter
        /// (which may be an <see cref="IEntryFilter"/>) that can complete the
        /// task using an iterating implementation. If, on the other hand, the
        /// filter does fully evaluate the remaining keys using just the index
        /// information, then it should return <c>null</c> to indicate that no
        /// further filtering is necessary.
        /// </remarks>
        /// <param name="indexes">
        /// The available <see cref="ICacheIndex"/> objects keyed by the
        /// related IValueExtractor; read-only.
        /// </param>
        /// <param name="keys">
        /// The mutable set of keys that remain to be filtered.
        /// </param>
        /// <returns>
        /// An <see cref="IFilter"/> object that can be used to process the
        /// remaining keys, or <c>null</c> if no additional filter processing
        /// is necessary.
        /// </returns>
        public new IFilter ApplyIndex(IDictionary indexes, ICollection keys)
        {
            if (LowerBound == null || UpperBound == null)
            {
                CollectionUtils.Clear(keys);
                return(null);
            }

            var invertedIndex = GetInvertedIndex(indexes);

            if (invertedIndex == null)
            {
                return(this);
            }

            if (invertedIndex is SortedDictionary)
            {
                return(ApplySortedIndex(keys, invertedIndex));
            }

            ArrayList toRetain = new ArrayList();

            foreach (var indexValue in invertedIndex.Keys)
            {
                if (EvaluateExtracted(indexValue))
                {
                    toRetain.AddRange((ICollection)invertedIndex[indexValue]);
                }
            }

            CollectionUtils.RetainAll(keys, toRetain);

            return(null);
        }
Ejemplo n.º 11
0
 public void Dispose()
 {
     this.isClose = true;
     if (readBuffer != null)
     {
         readBuffer = null;
     }
     if (temps != null)
     {
         try
         {
             CollectionUtils.Clear(temps);
             temps = null;
         }
         catch (Exception)
         {
         }
     }
     if (printTags != null)
     {
         CollectionUtils.Clear(printTags);
         printTags = null;
     }
     if (randTags != null)
     {
         CollectionUtils.Clear(randTags);
         randTags = null;
     }
     if (exp != null)
     {
         exp.Dispose();
     }
 }
Ejemplo n.º 12
0
 public void UpdateMove()
 {
     lock (typeof(MoveObject))
     {
         if (!GetCollisionArea().Contains(touchX, touchY))
         {
             if (findPath != null)
             {
                 CollectionUtils.Clear(findPath);
             }
             findPath = AStarFinder
                        .Find(heuristic,
                              tiles.GetField(),
                              tiles.PixelsToTilesWidth(X()),
                              tiles.PixelsToTilesHeight(Y()),
                              tiles.PixelsToTilesWidth(touchX
                                                       - tiles.GetOffset().x),
                              tiles.PixelsToTilesHeight(touchY
                                                        - tiles.GetOffset().y), allDirection);
         }
         else if (findPath != null)
         {
             CollectionUtils.Clear(findPath);
         }
     }
 }
        /// <summary>
        /// Initialize the aggregation result.
        /// </summary>
        /// <param name="isFinal">
        /// <b>true</b> is passed if the aggregation process that is being
        /// initialized must produce a final aggregation result; this will
        /// only be <b>false</b> if a parallel approach is being used and the
        /// initial (partial) aggregation process is being initialized.
        /// </param>
        protected override void Init(bool isFinal)
        {
            ICollection coll = m_coll;

            if (coll != null)
            {
                CollectionUtils.Clear(coll);
            }
        }
Ejemplo n.º 14
0
        public void RemoveAll()
        {
            int count = objects.Count;

            for (int i = 0; i < count; i++)
            {
                CollectionUtils.Add(pendingRemove, objects[i]);
            }
            CollectionUtils.Clear(pendingAdd);
        }
Ejemplo n.º 15
0
 public void Add(int id, float x, float y)
 {
     for (int i = 0; i < Count; i++)
     {
         if (this[i].id == id)
         {
             CollectionUtils.Clear(this);
         }
     }
     CollectionUtils.Add(this, new LTouchLocation(id, LTouchLocationState.Pressed, x, y));
 }
Ejemplo n.º 16
0
 public void Add(int id, Vector2f position)
 {
     for (int i = 0; i < Count; i++)
     {
         if (this[i].id == id)
         {
             CollectionUtils.Clear(this);
         }
     }
     CollectionUtils.Add(this, new LTouchLocation(id, LTouchLocationState.Pressed, position));
 }
Ejemplo n.º 17
0
        public void RemoveAll()
        {
            int count = objects.Count;

            object[] objectArray = CollectionUtils.ToArray(objects);
            for (int i = 0; i < count; i++)
            {
                CollectionUtils.Add(pendingRemove, (Gravity)objectArray[i]);
            }
            CollectionUtils.Clear(pendingAdd);
        }
Ejemplo n.º 18
0
 public void ClearPath()
 {
     if (pActorPath != null)
     {
         lock (pActorPath)
         {
             CollectionUtils.Clear(pActorPath);
             pActorPath = null;
         }
     }
 }
Ejemplo n.º 19
0
 public virtual void Dispose()
 {
     foreach (LRelease release in objects)
     {
         if (release != null)
         {
             release.Dispose();
         }
     }
     CollectionUtils.Clear(objects);
 }
Ejemplo n.º 20
0
 public void Clear()
 {
     if (!isClear)
     {
         lock (typeof(GameComponentCollection)) {
             CollectionUtils.Clear(collections);
             CollectionUtils.Clear(collectionsToUpdate);
             CollectionUtils.Clear(collectionsToDraw);
             isClear = true;
         }
     }
 }
 /// <summary>
 /// Remove the specified keys from the underlying store if present.
 /// </summary>
 /// <remarks>
 /// <p>
 /// The implementation of this method calls <see cref="Erase"/> for
 /// each key in the supplied <b>ICollection</b>. Once erased
 /// successfully, a key is removed from the <b>ICollection</b>
 /// (if possible).</p>
 /// <p>
 /// <b>Note:</b>
 /// For many types of persistent stores, a single erase operation is
 /// as expensive as a bulk erase operation; therefore, subclasses
 /// should override this method if possible.</p>
 /// </remarks>
 /// <param name="keys">
 /// Keys whose mappings are being removed from the cache.
 /// </param>
 /// <exception cref="NotSupportedException">
 /// If this implementation or the underlying store is read-only.
 /// </exception>
 public void EraseAll(ICollection keys)
 {
     foreach (object key in keys)
     {
         Erase(key);
     }
     try
     {
         CollectionUtils.Clear(keys);
     }
     catch (NotSupportedException) {}
 }
Ejemplo n.º 22
0
 public void Dispose()
 {
     this.visible = false;
     if (kernels != null)
     {
         for (int i = 0; i < kernels.Length; i++)
         {
             kernels[i].Dispose();
             kernels[i] = null;
         }
     }
     CollectionUtils.Clear(tex2ds);
 }
Ejemplo n.º 23
0
 public void RemoveAllActions(Event actObject)
 {
     if (actObject == null)
     {
         return;
     }
     Actions.ActionElement element = (Actions.ActionElement)actions.Get(actObject);
     if (element != null)
     {
         CollectionUtils.Clear(element.actions);
         DeleteElement(element);
     }
 }
Ejemplo n.º 24
0
        public void SetAnimationTime(float total)
        {
            int count = this._timeList.Count;

            if (count > 0)
            {
                float item = total / ((float)count);
                CollectionUtils.Clear(this._timeList);
                for (int i = 0; i < count; i++)
                {
                    CollectionUtils.Add(this._timeList, item);
                }
            }
        }
Ejemplo n.º 25
0
 public static void DisposeAll()
 {
     if (images.Count > 0)
     {
         foreach (LImage img in images)
         {
             if (img != null)
             {
                 img.Dispose(false);
             }
         }
         CollectionUtils.Clear(images);
     }
 }
Ejemplo n.º 26
0
 private IList GetIntersectingObjects(float[] r,
                                      CollisionQuery query)
 {
     lock (cacheSet)
     {
         CollectionUtils.Clear(cacheSet);
         GetIntersectingObjects(r, query, cacheSet, this.bspTree);
         List <Actor> result = new List <Actor>(cacheSet.Count);
         for (IEnumerator it = cacheSet.GetEnumerator(); it.MoveNext();)
         {
             result.Add((Actor)it.Current);
         }
         return(result);
     }
 }
Ejemplo n.º 27
0
 public void OnPosition(float x, float y)
 {
     if (findPath == null)
     {
         return;
     }
     lock (findPath)
     {
         if (findPath != null)
         {
             CollectionUtils.Clear(findPath);
         }
     }
     this.SetLocation(x, y);
 }
Ejemplo n.º 28
0
 private List <Vector2f> Calc(Field2D field_0, Vector2f start,
                              Vector2f goal_1, bool flag_2)
 {
     if (start.Equals(goal_1))
     {
         List <Vector2f> v = new List <Vector2f>();
         CollectionUtils.Add(v, start);
         return(v);
     }
     this.goal = goal_1;
     if (visitedCache == null)
     {
         visitedCache = new HashedSet();
     }
     else
     {
         CollectionUtils.Clear(visitedCache);
     }
     if (pathes == null)
     {
         pathes = new List <ScoredPath>();
     }
     else
     {
         CollectionUtils.Clear(pathes);
     }
     CollectionUtils.Add(visitedCache, start);
     if (path == null)
     {
         path = new List <Vector2f>();
     }
     else
     {
         CollectionUtils.Clear(path);
     }
     CollectionUtils.Add(path, start);
     if (spath == null)
     {
         spath = new AStarFinder.ScoredPath(0, path);
     }
     else
     {
         spath.score = 0;
         spath.path  = path;
     }
     CollectionUtils.Add(pathes, spath);
     return(Astar(field_0, flag_2));
 }
Ejemplo n.º 29
0
        public void Dispose()
        {
            this.visible = false;
            int size = barCaches.Count;

            for (int i = 0; i < size; i++)
            {
                StatusBar bar = barCaches[i];
                if (bar != null)
                {
                    bar.Dispose();
                    bar = null;
                }
            }
            CollectionUtils.Clear(barCaches);
            barCaches = null;
        }
Ejemplo n.º 30
0
 public void Clear()
 {
     lock (typeof(CollisionManager)) {
         if (collisionChecker != null)
         {
             collisionChecker.Dispose();
             collisionChecker.Clear();
         }
         if (freeObjects != null)
         {
             freeObjects.Clear();
         }
         if (collisionClasses != null)
         {
             CollectionUtils.Clear(collisionClasses);
         }
     }
 }