コード例 #1
0
ファイル: Model.cs プロジェクト: thisiscam/formula
 internal void AddFact(ModelFact f, bool addLast = true)
 {
     Contract.Requires(f != null);
     if (addLast)
     {
         facts.AddLast(f);
     }
     else
     {
         facts.AddFirst(f);
     }
 }
コード例 #2
0
        internal override Node DeepClone(IEnumerable <Node> clonedChildren, bool keepCompilerData)
        {
            var cnode = new ModelFact(this, keepCompilerData);

            cnode.cachedHashCode = this.cachedHashCode;
            using (var cenum = clonedChildren.GetEnumerator())
            {
                if (Config != null)
                {
                    cnode.Config = TakeClone <Config>(cenum);
                }

                cnode.Binding = Binding == null ? null : TakeClone <Id>(cenum);
                cnode.Match   = TakeClone <Node>(cenum);
            }

            return(cnode);
        }
コード例 #3
0
        internal override Node ShallowClone(Node replace, int pos)
        {
            var cnode  = new ModelFact(this, true);
            int occurs = 0;

            if (Config != null)
            {
                cnode.Config = CloneField <Config>(Config, replace, pos, ref occurs);
            }

            if (Binding != null)
            {
                cnode.Binding = CloneField <Id>(Binding, replace, pos, ref occurs);
            }

            cnode.Match = CloneField <Node>(Match, replace, pos, ref occurs);
            return(cnode);
        }
コード例 #4
0
 private ModelFact(ModelFact n, bool keepCompilerData)
     : base(n.Span)
 {
     CompilerData = keepCompilerData ? n.CompilerData : null;
 }