public void Remove(EventBean theEvent, AnyMap parent)
        {
            Object sortable = _propertyGetter.Get(theEvent);

            if (sortable == null)
            {
                if (_nullKeys != null)
                {
                    _nullKeys.Remove(theEvent);
                }
                return;
            }

            sortable = EventBeanUtility.Coerce(sortable, _coercionType);

            // if this is a leaf, remove event
            if (_next == null)
            {
                var eventMap = parent;
                if (eventMap == null)
                {
                    return;
                }

                var events = eventMap.Get(sortable) as ICollection <EventBean>;
                if (events == null)
                {
                    return;
                }

                if (!events.Remove(theEvent))
                {
                    return;
                }

                if (events.IsEmpty())
                {
                    parent.Remove(sortable);
                }
            }
            else
            {
                var innerIndex = (AnyMap)parent.Get(sortable);
                if (innerIndex == null)
                {
                    return;
                }
                _next.Remove(theEvent, innerIndex);
                if (innerIndex.IsEmpty())
                {
                    parent.Remove(sortable);
                }
            }
        }
Example #2
0
 public static void RemoveComponent(this Entity entity, Type componentType)
 {
     if (IsComponent(componentType) && EntityExists(entity))
     {
         ApiProvider.RemoveComponentFromScene(entity, componentType);
         components.Remove(entity.Index, entity.Gen, componentType);
     }
 }
Example #3
0
        public void Remove(EventBean theEvent, AnyMap parent)
        {
            var mk         = EventBeanUtility.GetMultiKey(theEvent, _propertyGetters, _keyCoercionTypes);
            var innerIndex = (AnyMap)parent.Get(mk);

            if (innerIndex == null)
            {
                return;
            }
            _next.Remove(theEvent, innerIndex);
            if (innerIndex.IsEmpty())
            {
                parent.Remove(mk);
            }
        }