Пример #1
0
        public ValueNode CreateValueNode(OperatorNode parent, object value)
        {
            var pos  = parent.HasLeft ? TreeNodePosition.RIGHT : TreeNodePosition.LEFT;
            var nid  = pos == TreeNodePosition.LEFT ? CountChildren(parent) + 1 : CountChildren(parent) + 2;
            var node = new ValueNode(nid, parent.Id, pos, value)
            {
                Parent = parent
            };

            return(node);
        }
Пример #2
0
        public OperatorNode CreateOperatorNode(OperatorNode parent, TensorOp op)
        {
            var pos  = parent.HasLeft ? TreeNodePosition.RIGHT : TreeNodePosition.LEFT;
            var nid  = pos == TreeNodePosition.LEFT ? CountChildren(parent) + 1 : CountChildren(parent) + 2;
            var node = new OperatorNode(nid, parent.Id, pos, op)
            {
                Parent = parent
            };

            return(node);
        }