示例#1
0
 public UndoableRleCollectionSetValueHistoryItem(IDocumentModel documentModel, RleCollection <T> collection, int index, T value)
     : base(documentModel.MainPart)
 {
     this.collection = collection;
     this.newValue   = value;
     this.index      = index;
 }
示例#2
0
 public UndoableRleCollectionRemoveRangeHistoryItem(IDocumentModel documentModel, RleCollection <T> collection, int index, int count)
     : base(documentModel.MainPart)
 {
     this.collection = collection;
     this.index      = index;
     this.count      = count;
 }
示例#3
0
 public UndoableRleCollectionInsertRangeHistoryItem(IDocumentModel documentModel, RleCollection <T> collection, int index, IRleCollection <T> range, IRleCollectionValueConverter <T> valueConverter)
     : base(documentModel.MainPart)
 {
     this.collection     = collection;
     this.index          = index;
     this.newRange       = range;
     this.valueConverter = valueConverter;
 }
示例#4
0
 public UndoableRleCollectionSetRangeValueHistoryItem(IDocumentModel documentModel, RleCollection <T> collection, int startIndex, int endIndex, T value)
     : base(documentModel.MainPart)
 {
     this.collection = collection;
     this.startIndex = startIndex;
     this.endIndex   = endIndex;
     this.newValue   = value;
 }
示例#5
0
 public IndexEnumerator(RleCollection <T> collection, int startIndex, int endIndex, Predicate <T> match)
 {
     this.collection = collection;
     this.startIndex = startIndex;
     this.endIndex   = endIndex;
     this.match      = match;
     reversed        = startIndex > endIndex;
     Reset();
 }
示例#6
0
        public IRleCollection <T> GetRange(int startIndex, int endIndex)
        {
            CheckRangeIndexes(startIndex, endIndex);
            RleCollection <T> result = new RleCollection <T>(endIndex - startIndex + 1);

            result.ImmutableValues = this.ImmutableValues;
            int         itemIndex  = GetItemIndex(startIndex);
            RleItem <T> sourceItem = items[itemIndex];

            while (sourceItem != null && sourceItem.StartIndex <= endIndex)
            {
                RleItem <T> item = new RleItem <T>(sourceItem.Value,
                                                   Math.Max(sourceItem.StartIndex, startIndex) - startIndex,
                                                   Math.Min(sourceItem.EndIndex, endIndex) - startIndex);
                result.items.Add(item);
                itemIndex++;
                sourceItem = itemIndex < items.Count ? items[itemIndex] : null;
            }
            return(result);
        }
示例#7
0
 public UndoableRleCollection(IDocumentModelPart documentModelPart, int length, T defaultValue)
 {
     this.documentModelPart = documentModelPart;
     this.innerCollection   = new RleCollection <T>(length, defaultValue);
 }
示例#8
0
 public void Dispose()
 {
     collection = null;
 }