public void TransferOwnership(HVector source) { if (source == this) { return; } if (source != null && source.Dimension != this.Dimension) { throw new HVectorAccessException("Vector dimension mismatch"); } this.Dispose(); if (source == null) { return; } if (this.mDimension <= 0) { throw new HVectorAccessException("TransferOwnership not implemented for leaf"); } this.mVector = source.mVector; source.mVector = new List <HVector>(); if (!this.IsDisposable()) { return; } GC.ReRegisterForFinalize((object)this); }
protected override bool EqualsImpl(HVector vector) { if (this.mDimension >= 1) { return(base.EqualsImpl(vector)); } return(((HObjectVector)vector).O.TestEqualObj(this.O) != 0); }
/// <summary> /// Returns true if vector has same dimension, lengths, and elements /// </summary> public bool VectorEqual(HVector vector) { if (vector.GetType() != this.GetType()) { return(false); } return(this.EqualsImpl(vector)); }
protected override bool EqualsImpl(HVector vector) { if (this.mDimension >= 1) { return(base.EqualsImpl(vector)); } return((bool)((HTupleVector)vector).T.TupleEqual(this.T)); }
private static string BuildMessage(HVector sender, string sInfo) { string str = sInfo; if (sender != null) { str = "'" + str + "' when accessing '" + sender.ToString() + "'"; } return(str); }
protected HVector(HVector vector) : this(vector.Dimension) { if (this.mDimension <= 0) { return; } this.mVector.Capacity = vector.Length; for (int index = 0; index < vector.Length; ++index) { this.mVector.Add(vector[index].Clone()); } }
protected void InsertImpl(int index, HVector vector, bool clone) { if (this.mDimension < 1 || vector.Dimension != this.mDimension - 1) { throw new HVectorAccessException("Vector dimension mismatch"); } if (index < 0) { throw new HVectorAccessException("Index out of range"); } this.AssertSize(index - 1); lock (this.mVector) this.mVector.Insert(index, clone ? vector.Clone() : vector); }
protected HVector ConcatImpl(HVector vector, bool append, bool clone) { if (this.mDimension < 1 || vector.Dimension != this.mDimension) { throw new HVectorAccessException("Vector dimension mismatch"); } HVector hvector = append ? this : this.Clone(); hvector.mVector.Capacity = this.Length + vector.Length; for (int index = 0; index < vector.Length; ++index) { hvector.mVector.Add(clone ? vector[index].Clone() : vector[index]); } return(hvector); }
protected virtual bool EqualsImpl(HVector vector) { if (vector.Dimension != this.Dimension || vector.Length != this.Length) { return(false); } if (this.mDimension > 0) { for (int index = 0; index < this.Length; ++index) { if (!this[index].VectorEqual(vector[index])) { return(false); } } } return(true); }
internal HVectorAccessException(HVector sender, string sInfo, Exception inner) : base(HVectorAccessException.BuildMessage(sender, sInfo), (Exception)null) { }
public HVector Insert(int index, HVector vector, bool clone) { this.InsertImpl(index, vector, clone); return(this); }
public HVector Append(HVector vector, bool clone) { return(this.ConcatImpl(vector, true, clone)); }
/// <summary>Append vector to this vector</summary> public HVector Append(HVector vector) { return(this.ConcatImpl(vector, true, true)); }
public HVector Concat(HVector vector, bool clone) { return(this.ConcatImpl(vector, false, clone)); }
/// <summary>Concatenate two vectors, creating new vector</summary> public HVector Concat(HVector vector) { return(this.ConcatImpl(vector, false, true)); }
internal HVectorAccessException(HVector sender, string sInfo) : this(sender, sInfo, (Exception)null) { }
internal HVectorAccessException(HVector sender) : this(sender, "Illegal operation on vector") { }
/// <summary>Insert vector at specified index</summary> public HVector Insert(int index, HVector vector) { this.InsertImpl(index, vector, true); return(this); }