Esempio n. 1
0
        public virtual global::Array <object> SerializeRelations()
        {
            global::Array <object> json = new global::Array <object>();

            {
                object key = ((global::haxe.ds.ObjectMap <object, object>)(global::haxe.ds.ObjectMap <object, object> .__hx_cast <object, object>(((global::haxe.ds.ObjectMap)(((global::haxe.IMap <object, object>)(this._relations))))))).keys();
                while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(key, "hasNext", 407283053, null)))
                {
                    global::graph.EndPoint key1         = ((global::graph.EndPoint)(global::haxe.lang.Runtime.callField(key, "next", 1224901875, null)));
                    string endPointJson                 = key1.SerializeToJson();
                    global::Array <object> relationObj  = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.ObjectMap <object, object>)(global::haxe.ds.ObjectMap <object, object> .__hx_cast <object, object>(((global::haxe.ds.ObjectMap)(((global::haxe.IMap <object, object>)(this._relations))))))).@get(key1)).@value)))));
                    global::Array <object> relationJson = new global::Array <object>();
                    {
                        int _g = 0;
                        while ((_g < relationObj.length))
                        {
                            global::graph.EndPoint obj = ((global::graph.EndPoint)(relationObj[_g]));
                            ++_g;
                            relationJson.push(obj.SerializeToJson());
                        }
                    }

                    object realtionPair = new global::haxe.lang.DynamicObject(new int[] { 4949376, 1224901875 }, new object[] { endPointJson, relationJson }, new int[] {}, new double[] {});
                    json.push(global::haxe.format.JsonPrinter.print(realtionPair, null, null));
                }
            }

            return(json);
        }
Esempio n. 2
0
        public virtual void SignalOutput(int slotId)
        {
            bool executionCheckRequired = false;

            if ((slotId > 0))
            {
                global::core.slot.Slot slot = ((global::core.slot.Slot)((((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)(((global::haxe.IMap <int, object>)(this._slots))))))).@get(slotId)).@value));
                if ((slot != null))
                {
                    global::graph.EndPoint curEndpoint = new global::graph.EndPoint(new global::haxe.lang.Null <int>(this.nodeId, true), new global::haxe.lang.Null <int>(slotId, true));
                    global::Array <object> endpoints   = this.owner.GetConnectedEndpoints(curEndpoint);
                    {
                        int _g = 0;
                        while ((_g < endpoints.length))
                        {
                            global::graph.EndPoint endpoint = ((global::graph.EndPoint)(endpoints[_g]));
                            ++_g;
                            global::core.node.Node nextNode = this.owner.FindNode(endpoint.nodeId);
                            if ((nextNode != null))
                            {
                                this.owner.AddToExecutionStack(endpoint);
                                executionCheckRequired = true;
                            }
                        }
                    }
                }
            }

            if (executionCheckRequired)
            {
                this.owner.Execute();
            }
        }
Esempio n. 3
0
 public static void __hx_ctor_graph_EndPoint(global::graph.EndPoint __hx_this, global::haxe.lang.Null <int> nodeId, global::haxe.lang.Null <int> slotId)
 {
     unchecked {
         int __temp_slotId6 = ((!(slotId.hasValue)) ? (-1) : ((slotId).@value));
         int __temp_nodeId5 = ((!(nodeId.hasValue)) ? (-1) : ((nodeId).@value));
         __hx_this.nodeId = __temp_nodeId5;
         __hx_this.slotId = __temp_slotId6;
     }
 }
Esempio n. 4
0
        public override void DeserializeFromJson(string json)
        {
            object obj = new global::haxe.format.JsonParser(((string)(json))).parseRec();

            this.graphId = global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.getField(obj, "graphId", 1946631881, true));
            global::Array <object> nodes = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(global::haxe.lang.Runtime.getField(obj, "nodes", 532592689, true))))));
            {
                int _g = 0;
                while ((_g < nodes.length))
                {
                    string item = global::haxe.lang.Runtime.toString(nodes[_g]);
                    ++_g;
                    global::core.node.Node node = new global::core.node.Node();
                    node.DeserializeFromJson(item);
                    node.owner = this;
                    ((global::haxe.ds.IntMap <object>)(global::haxe.ds.IntMap <object> .__hx_cast <object>(((global::haxe.ds.IntMap)(((global::haxe.IMap <int, object>)(this._nodes))))))).@set(node.nodeId, node);
                }
            }

            global::Array <object> relations = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(global::haxe.lang.Runtime.getField(obj, "relations", 1682648631, true))))));
            {
                int _g1 = 0;
                while ((_g1 < relations.length))
                {
                    string item1 = global::haxe.lang.Runtime.toString(relations[_g1]);
                    ++_g1;
                    object relationPairObj          = new global::haxe.format.JsonParser(((string)(item1))).parseRec();
                    global::graph.EndPoint endPoint = new global::graph.EndPoint(default(global::haxe.lang.Null <int>), default(global::haxe.lang.Null <int>));
                    endPoint.DeserializeFromJson(global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.getField(relationPairObj, "cur", 4949376, true)));
                    global::Array <object> endPoints = new global::Array <object>();
                    {
                        int _g11 = 0;
                        global::Array <object> _g2 = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)(global::haxe.lang.Runtime.getField(relationPairObj, "next", 1224901875, true))))));
                        while ((_g11 < _g2.length))
                        {
                            string ep = global::haxe.lang.Runtime.toString(_g2[_g11]);
                            ++_g11;
                            global::graph.EndPoint point = new global::graph.EndPoint(default(global::haxe.lang.Null <int>), default(global::haxe.lang.Null <int>));
                            point.DeserializeFromJson(ep);
                            endPoints.push(point);
                        }
                    }

                    ((global::haxe.ds.ObjectMap <object, object>)(global::haxe.ds.ObjectMap <object, object> .__hx_cast <object, object>(((global::haxe.ds.ObjectMap)(((global::haxe.IMap <object, object>)(this._relations))))))).@set(endPoint, endPoints);
                }
            }
        }
Esempio n. 5
0
 public static void main()
 {
     unchecked {
         global::core.slot.Slot dataSlotIn = new global::core.slot.Slot();
         dataSlotIn.Initialize(1, global::core.slot.SlotType.DataIn);
         global::core.slot.Slot actionSlotIn = new global::core.slot.Slot();
         actionSlotIn.Initialize(2, global::core.slot.SlotType.ExecutionIn);
         global::core.slot.Slot dataSlotOut = new global::core.slot.Slot();
         dataSlotOut.Initialize(3, global::core.slot.SlotType.DataOut);
         global::core.slot.Slot actionSlotOut = new global::core.slot.Slot();
         actionSlotOut.Initialize(4, global::core.slot.SlotType.ExecutionOut);
         global::core.node.Node actionNode = new global::core.node.Node();
         actionNode.Initialize(new global::haxe.lang.Null <int>(1, true), "First Node", "Action Node");
         actionNode.AddSlot(actionSlotOut);
         actionNode.AddSlot(dataSlotIn);
         actionNode.AddSlot(actionSlotIn);
         global::core.node.Node dataNode = new global::core.node.Node();
         dataNode.Initialize(new global::haxe.lang.Null <int>(2, true), "Second Node", "Data Node");
         dataNode.AddSlot(dataSlotOut);
         global::core.node.Node node3 = new global::core.node.Node();
         node3.Initialize(new global::haxe.lang.Null <int>(3, true), "Third Node", "Action Node");
         node3.AddSlot(dataSlotIn);
         node3.AddSlot(actionSlotOut);
         node3.AddSlot(actionSlotIn);
         global::core.node.Node node4 = new global::core.node.Node();
         node4.Initialize(new global::haxe.lang.Null <int>(4, true), "Forth Node", "Action Node");
         node4.AddSlot(actionSlotIn);
         global::graph.Graph graph1 = new global::graph.Graph(((string)("testGraphData")));
         graph1.AddNode(actionNode);
         graph1.AddNode(dataNode);
         graph1.AddNode(node3);
         graph1.AddNode(node4);
         global::graph.EndPoint ep1 = new global::graph.EndPoint(new global::haxe.lang.Null <int>(actionNode.nodeId, true), new global::haxe.lang.Null <int>(actionSlotOut.slotId, true));
         global::graph.EndPoint ep2 = new global::graph.EndPoint(new global::haxe.lang.Null <int>(dataNode.nodeId, true), new global::haxe.lang.Null <int>(dataSlotOut.slotId, true));
         global::graph.EndPoint ep3 = new global::graph.EndPoint(new global::haxe.lang.Null <int>(node3.nodeId, true), new global::haxe.lang.Null <int>(actionSlotIn.slotId, true));
         global::graph.EndPoint ep4 = new global::graph.EndPoint(new global::haxe.lang.Null <int>(node3.nodeId, true), new global::haxe.lang.Null <int>(dataSlotIn.slotId, true));
         global::graph.EndPoint ep5 = new global::graph.EndPoint(new global::haxe.lang.Null <int>(node3.nodeId, true), new global::haxe.lang.Null <int>(actionSlotOut.slotId, true));
         global::graph.EndPoint ep6 = new global::graph.EndPoint(new global::haxe.lang.Null <int>(node4.nodeId, true), new global::haxe.lang.Null <int>(actionSlotIn.slotId, true));
         graph1.AddRelation(ep1, new global::Array <object>(new object[] { ep3 }));
         graph1.AddRelation(ep2, new global::Array <object>(new object[] { ep4 }));
         graph1.AddRelation(ep5, new global::Array <object>(new object[] { ep6 }));
         string str = graph1.SerializeToJson();
         global::haxe.Log.trace.__hx_invoke2_o(default(double), str, default(double), new global::haxe.lang.DynamicObject(new int[] { 302979532, 1547539107, 1648581351 }, new object[] { "main", "Entry", "Entry.hx" }, new int[] { 1981972957 }, new double[] { ((double)(151)) }));
     }
 }
Esempio n. 6
0
        public virtual void Execute()
        {
            while ((this._stack.head != null))
            {
                global::haxe.ds.GenericStack <object> _this = this._stack;
                global::haxe.ds.GenericCell <object>  k     = _this.head;
                global::graph.EndPoint endpoint             = null;
                if ((k == null))
                {
                    endpoint = null;
                }
                else
                {
                    _this.head = k.next;
                    endpoint   = ((global::graph.EndPoint)(k.elt));
                }

                global::core.node.Node node = this.FindNode(endpoint.nodeId);
                if ((node != null))
                {
                    node.SignalInput(endpoint.slotId);
                }
            }
        }
Esempio n. 7
0
 public virtual void AddRelation(global::graph.EndPoint curEP, global::Array <object> nextEPS)
 {
     ((global::haxe.ds.ObjectMap <object, object>)(global::haxe.ds.ObjectMap <object, object> .__hx_cast <object, object>(((global::haxe.ds.ObjectMap)(((global::haxe.IMap <object, object>)(this._relations))))))).@set(curEP, nextEPS);
 }
Esempio n. 8
0
 public virtual void AddToExecutionStack(global::graph.EndPoint endpoint)
 {
     global::haxe.ds.GenericStack <object> _this = this._stack;
     _this.head = new global::haxe.ds.GenericCell <object>(endpoint, _this.head);
 }
Esempio n. 9
0
 public virtual global::Array <object> GetConnectedEndpoints(global::graph.EndPoint first)
 {
     return((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.ObjectMap <object, object>)(global::haxe.ds.ObjectMap <object, object> .__hx_cast <object, object>(((global::haxe.ds.ObjectMap)(((global::haxe.IMap <object, object>)(this._relations))))))).@get(first)).@value)))));
 }