예제 #1
0
        private IList <N> DoSelect <N>(Entity entity, Type groupComponentType) where N : Node
        {
            ICollection <Entity> is2;
            GroupComponent       componentUnsafe = (GroupComponent)((EntityUnsafe)entity).GetComponentUnsafe(groupComponentType);

            if (componentUnsafe == null)
            {
                return(Collections.EmptyList <N>());
            }
            NodeClassInstanceDescription orCreateNodeClassDescription = NodeDescriptionRegistry.GetOrCreateNodeClassDescription(typeof(N), null);

            NodeDescriptionRegistry.AssertRegister(orCreateNodeClassDescription.NodeDescription);
            return(((is2 = componentUnsafe.GetGroupMembers(orCreateNodeClassDescription.NodeDescription)).Count != 0) ? ((is2.Count != 1) ? ((IList <N>) this.ConvertNodeCollection(orCreateNodeClassDescription, is2)) : Collections.SingletonList <N>((N)this.GetNode(Collections.GetOnlyElement <Entity>(is2), orCreateNodeClassDescription))) : Collections.EmptyList <N>());
        }
예제 #2
0
        public void AddState <T>() where T : Node, new()
        {
            Type key = typeof(T);

            if (this.entityStates.ContainsKey(key))
            {
                throw new EntityStateAlreadyRegisteredException(key);
            }
            EntityState state = new EntityState(key, NodeDescriptionRegistry.GetOrCreateNodeClassDescription(key, null).NodeDescription);

            if (this.entity != null)
            {
                state.Entity = this.entity;
            }
            this.entityStates[key] = state;
        }
예제 #3
0
        private static HandlerArgument CreateNodeType(int position, Type type, Optional <JoinType> join, Optional <JoinType> rightJoin, object[] annotatedTypes, bool isNodeChangeHandler)
        {
            Type nodeType = GetNodeType(type);

            if (nodeType == null)
            {
                return(null);
            }
            HashSet <Type> components = new HashSet <Type>();
            bool           context    = IsContextNode(annotatedTypes, join);

            if (isNodeChangeHandler && context)
            {
                CollectGroupComponent(join, components);
                CollectGroupComponent(rightJoin, components);
            }
            NodeClassInstanceDescription orCreateNodeClassDescription = NodeDescriptionRegistry.GetOrCreateNodeClassDescription(nodeType, components);

            return(new HandlerArgumentBuilder().SetPosition(position).SetType(type).SetJoinType(join).SetContext(context).SetCollection(IsCollection(type)).SetNodeClassInstanceDescription(orCreateNodeClassDescription).SetMandatory(IsMandatory(annotatedTypes)).SetCombine(IsCombine(annotatedTypes)).SetOptional(IsOptional(type)).Build());
        }
예제 #4
0
        private bool CheckNodeIsActual(Node node)
        {
            NodeClassInstanceDescription orCreateNodeClassDescription = NodeDescriptionRegistry.GetOrCreateNodeClassDescription(node.GetType(), null);

            return(((EntityImpl)node.Entity).NodeDescriptionStorage.Contains(orCreateNodeClassDescription.NodeDescription));
        }