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); } } }
/// <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); }
public void Clear() { lock (barCaches) { CollectionUtils.Clear(barCaches); } }
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(); } }
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); }
public void Dispose() { if (_fsList != null) { CollectionUtils.Clear(_fsList); } }
/// <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); }
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(); } } } }
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(); } }
/// <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); }
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(); } }
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); } }
public void RemoveAll() { int count = objects.Count; for (int i = 0; i < count; i++) { CollectionUtils.Add(pendingRemove, objects[i]); } CollectionUtils.Clear(pendingAdd); }
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)); }
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)); }
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); }
public void ClearPath() { if (pActorPath != null) { lock (pActorPath) { CollectionUtils.Clear(pActorPath); pActorPath = null; } } }
public virtual void Dispose() { foreach (LRelease release in objects) { if (release != null) { release.Dispose(); } } CollectionUtils.Clear(objects); }
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) {} }
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); }
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); } }
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); } } }
public static void DisposeAll() { if (images.Count > 0) { foreach (LImage img in images) { if (img != null) { img.Dispose(false); } } CollectionUtils.Clear(images); } }
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); } }
public void OnPosition(float x, float y) { if (findPath == null) { return; } lock (findPath) { if (findPath != null) { CollectionUtils.Clear(findPath); } } this.SetLocation(x, y); }
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)); }
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; }
public void Clear() { lock (typeof(CollisionManager)) { if (collisionChecker != null) { collisionChecker.Dispose(); collisionChecker.Clear(); } if (freeObjects != null) { freeObjects.Clear(); } if (collisionClasses != null) { CollectionUtils.Clear(collisionClasses); } } }