public override bool Equals(com.epl.geometry.AttributeStreamBase other, int start, int end) { if (other == null) { return(false); } if (!(other is com.epl.geometry.AttributeStreamOfInt16)) { return(false); } com.epl.geometry.AttributeStreamOfInt16 _other = (com.epl.geometry.AttributeStreamOfInt16)other; int size = Size(); int sizeOther = _other.Size(); if (end > size || end > sizeOther && (size != sizeOther)) { return(false); } if (end > size) { end = size; } for (int i = start; i < end; i++) { if (Read(i) != _other.Read(i)) { return(false); } } return(true); }
public AttributeStreamOfInt16(com.epl.geometry.AttributeStreamOfInt16 other, int maxSize) { m_size = other.Size(); if (m_size > maxSize) { m_size = maxSize; } int sz = m_size; if (sz < 2) { sz = 2; } m_buffer = new short[sz]; System.Array.Copy(other.m_buffer, 0, m_buffer, 0, m_size); }
public override void WriteRange(int startElement, int count, com.epl.geometry.AttributeStreamBase _src, int srcStart, bool bForward, int stride) { if (startElement < 0 || count < 0 || srcStart < 0) { throw new System.ArgumentException(); } if (!bForward && (stride <= 0 || (count % stride != 0))) { throw new System.ArgumentException(); } com.epl.geometry.AttributeStreamOfInt16 src = (com.epl.geometry.AttributeStreamOfInt16)_src; // the input // type must // match if (src.Size() < (int)(srcStart + count)) { throw new System.ArgumentException(); } if (count == 0) { return; } if (Size() < count + startElement) { Resize(count + startElement); } if (_src == (com.epl.geometry.AttributeStreamBase) this) { _selfWriteRangeImpl(startElement, count, srcStart, bForward, stride); return; } if (bForward) { int j = startElement; int offset = srcStart; for (int i = 0; i < count; i++) { m_buffer[j] = src.m_buffer[offset]; j++; offset++; } } else { int j = startElement; int offset = srcStart + count - stride; if (stride == 1) { for (int i = 0; i < count; i++) { m_buffer[j] = src.m_buffer[offset]; j++; offset--; } } else { for (int i = 0, n = count / stride; i < n; i++) { for (int k = 0; k < stride; k++) { m_buffer[j + k] = src.m_buffer[offset + k]; } j += stride; offset -= stride; } } } }