Beispiel #1
0
        /// <summary>
        /// If 'type.parent' was added in current transaction, 'type' technically did not change,
        /// it was just added and we should not fire events for 'type'.
        /// </summary>
        internal void AddChangedTypeToTransaction(AbstractType type, string parentSub)
        {
            var item = type._item;

            if (item == null || (BeforeState.TryGetValue(item.Id.Client, out int clock) && item.Id.Clock < clock && !item.Deleted))
            {
                if (!Changed.TryGetValue(type, out var set))
                {
                    set           = new HashSet <string>();
                    Changed[type] = set;
                }

                set.Add(parentSub);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a relative position based on an absolute position.
        /// </summary>
        public static RelativePosition FromTypeIndex(AbstractType type, int index)
        {
            var t = type._start;

            while (t != null)
            {
                if (!t.Deleted && t.Countable)
                {
                    if (t.Length > index)
                    {
                        // Case 1: found position somewhere in the linked list.
                        return(new RelativePosition(type, new ID(t.Id.Client, t.Id.Clock + index)));
                    }

                    index -= t.Length;
                }

                t = t.Right as Item;
            }

            return(new RelativePosition(type, null));
        }
Beispiel #3
0
 internal ContentType(AbstractType type)
 {
     Type = type;
 }
Beispiel #4
0
 public AbsolutePosition(AbstractType type, int index)
 {
     Type  = type;
     Index = index;
 }
Beispiel #5
0
 internal YEvent(AbstractType target, Transaction transaction)
 {
     Target        = target;
     CurrentTarget = target;
     Transaction   = transaction;
 }