public State VisitMutableBox(State state, MutableBoxDatum d)
        {
            if (state.BoxesSeen.Contains(d))
            {
                State s2 = new State
                           (
                    state.BoxesSeen,
                    state.BoxesReferenced.Add(d, new IntDatum(state.NextBoxNumber)),
                    state.NextBoxNumber + 1
                           );

                return(s2);
            }
            else
            {
                State s2 = new State
                           (
                    state.BoxesSeen.Add(d),
                    state.BoxesReferenced,
                    state.NextBoxNumber
                           );

                State s3 = d.Content.Visit <State>(this, s2);

                return(s3);
            }
        }
Пример #2
0
            public bool VisitMutableBox(MutableBoxDatum d)
            {
                bw.Write(B_MUTABLE_BOX);
                IntDatum id = (IntDatum)(mutableBoxMap[d]);

                bw.Write((int)id.Value);
                return(true);
            }
Пример #3
0
 private int CompareMutableBox(MutableBoxDatum x, MutableBoxDatum y)
 {
     if (x.ID < y.ID)
     {
         return(-1);
     }
     if (x.ID > y.ID)
     {
         return(1);
     }
     return(0);
 }
 public string VisitMutableBox(MutableBoxDatum d)
 {
     if (boxReferences.BoxesReferenced.ContainsKey(d))
     {
         if (boxesStarted.Contains(d))
         {
             return("#b[" + boxReferences.BoxesReferenced[d].Visit(this) + "]");
         }
         else
         {
             boxesStarted = boxesStarted.Add(d);
             return("#b[" + boxReferences.BoxesReferenced[d].Visit(this) + "]=" + d.Content.Visit(this));
         }
     }
     else
     {
         return("#b=" + d.Content.Visit(this));
     }
 }
 public SetDatum VisitMutableBox(MutableBoxDatum d)
 {
     if (visited.ContainsKey(d))
     {
         return((SetDatum)(visited[d]));
     }
     else if (visiting.Contains(d))
     {
         return(SetDatum.Empty);
     }
     else
     {
         visiting = SetDatum.Union(visiting, SetDatum.Singleton(d));
         SetDatum result = SetDatum.Union(d.Content.Visit(this), SetDatum.Singleton(d));
         visiting = SetDatum.Difference(visiting, SetDatum.Singleton(d));
         visited  = visited.Add(d, result);
         return(result);
     }
 }
Пример #6
0
        public SetDatum VisitMutableBox(MutableBoxDatum d)
        {
            bool firstTime;
            long id = idgen.GetId(d, out firstTime);

            if (firstTime)
            {
                SetDatum s = d.Content.Visit(this);
                mutableBoxCollections = mutableBoxCollections.Add(id, s);
                return(s);
            }
            else if (mutableBoxCollections.ContainsKey(id))
            {
                return(mutableBoxCollections[id]);
            }
            else
            {
                return(SetDatum.Empty);
            }
        }
Пример #7
0
 public string VisitMutableBox(MutableBoxDatum d)
 {
     return("m" + d.ID);
 }
 private bool EqualMutableBox(MutableBoxDatum x, MutableBoxDatum y)
 {
     return(x.ID == y.ID);
 }