/// <inheritdoc /> public bool TryGetValue(TIndex index, out TValue value) { IReadOnlyIndexableContracts.TryGetValue(this, index); lock (this.indexableLock) { return(this.indexable.TryGetValue(index, out value)); } }
/// <inheritdoc /> public bool IsIndexValid(TIndex index) { IReadOnlyIndexableContracts.IsIndexValid(this, index); lock (this.indexableLock) { return(this.indexable.IsIndexValid(index)); } }
/// <inheritdoc /> public TValue this[TIndex index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); return(this.ConstantValue); } }
/// <inheritdoc /> public T this[Index3D index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); Index3D subIndex; return(this.GetIndexable(index + this.originOffset, out subIndex)[subIndex]); } }
/// <inheritdoc /> public bool TryGetValue(TIndex index, out TValue value) { IReadOnlyIndexableContracts.TryGetValue(this, index); if (!this.dictionary.TryGetValue(index, out value)) { value = default(TValue); } return(true); }
/// <inheritdoc /> public override T this[Index2D index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); return(this.array[index - this.offset]); } set { IIndexableContracts.IndexerSet(this, index); this.array[index - this.offset] = value; } }
/// <inheritdoc /> public TResult this[TIndex index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); return(this.toResultConverter(this.indexable, index, this.indexable[index])); } set { IIndexableContracts.IndexerSet(this, index); this.toSourceAction(this.indexable, index, value); } }
/// <inheritdoc /> public override T this[Index4D index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); return(this.array[index.X, index.Y, index.Z, index.W]); } set { IIndexableContracts.IndexerSet(this, index); this.array[index.X, index.Y, index.Z, index.W] = value; } }
/// <inheritdoc /> public bool TryGetValue(TIndex index, out TResult value) { IReadOnlyIndexableContracts.TryGetValue(this, index); TSource sourceValue; if (this.indexable.TryGetValue(index, out sourceValue)) { value = this.toResultConverter(this.indexable, index, sourceValue); return(true); } else { value = default(TResult); return(false); } }
/// <inheritdoc /> public TValue this[TIndex index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); TValue result; return(this.dictionary.TryGetValue(index, out result) ? result : default(TValue)); } set { IIndexableContracts.IndexerSet(this, index); this.dictionary[index] = value; } }
/// <inheritdoc /> public override T this[Index3D index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); index = this.HandleArrayResizing(index); return(this.array[index.X, index.Y, index.Z]); } set { IIndexableContracts.IndexerSet(this, index); index = this.HandleArrayResizing(index); this.array[index.X, index.Y, index.Z] = value; } }
/// <inheritdoc /> public bool TryGetValue(TIndex key, out TValue value) { IDictionaryContracts.TryGetValue(key); IReadOnlyIndexableContracts.TryGetValue(this, key); TryValue <TValue> result; if (this.indexable.TryGetValue(key, out result)) { if (result.HasValue) { value = result.Value; return(true); } } // either the try get failed or the result had no value. Failure either way value = default(TValue); return(false); }
/// <inheritdoc /> public TValue this[TIndex index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); lock (this.indexableLock) { return(this.indexable[index]); } } set { IIndexableContracts.IndexerSet(this, index); lock (this.indexableLock) { this.indexable[index] = value; } } }
/// <inheritdoc /> public override T this[Index3D index] { get { IReadOnlyIndexableContracts.IndexerGet(this, index); return(this.GetIndexable(index.X, index.Z)[new Index3D( (index.X + this.singleArrayLengthX) % this.singleArrayLengthX, index.Y, (index.Z + this.singleArrayLengthZ) % this.singleArrayLengthZ)]); } set { IIndexableContracts.IndexerSet(this, index); this.GetIndexable(index.X, index.Z)[new Index3D( (index.X + this.singleArrayLengthX) % this.singleArrayLengthX, index.Y, (index.Z + this.singleArrayLengthZ) % this.singleArrayLengthZ)] = value; } }
/// <inheritdoc /> public TValue this[TIndex index] { // this method's contracts will check that the dictionary contains the key first get { IDictionaryContracts.IndexerGet(this, index); IReadOnlyIndexableContracts.IndexerGet(this, index); return(this.indexable[index].Value); } set { IDictionaryContracts.IndexerSet(this, index); IIndexableContracts.IndexerSet(this, index); if (!this.indexable[index].HasValue) { this.count++; } this.indexable[index] = TryValue.New(value); } }
/// <inheritdoc /> public virtual bool IsIndexValid(Index2D index) { IReadOnlyIndexableContracts.IsIndexValid(this, index); return(true); }
/// <inheritdoc /> public bool IsIndexValid(Index3D index) { IReadOnlyIndexableContracts.IsIndexValid(this, index); return(this.IsIndexInBounds(index)); }
/// <inheritdoc /> public override bool IsIndexValid(Index4D index) { IReadOnlyIndexableContracts.IsIndexValid(this, index); return(index.IsAllPositiveOrZero()); }
/// <inheritdoc /> public bool IsIndexValid(TIndex index) { IReadOnlyIndexableContracts.IsIndexValid(this, index); return(true); }