/// <summary> /// 将本对象的指定的属性拷贝对目标对象�? /// </summary> /// <param name="target"> 目标对象 </param> /// <param name="props"> 属性索�? </param> public void copyTo(IntNumberPropertyObject target, int[] props) { for (int i = 0; i < props.Length; i++) { target.set(props[i], this.get(props[i])); } }
/// <summary> /// 向指定的参数拷贝数据 /// </summary> /// <param name="target"> </param> /// <exception cref="IllegalArgumentException"> 如果target的对象类型与该类型不一�? </exception> public void copyTo(IntNumberPropertyObject target) { if (target.propertyType != this.propertyType) { throw new System.ArgumentException("Not the same property type."); } target.props.copyFrom(this.props); }
/// <summary> /// 从指定的参数中拷贝数据到本身 /// </summary> /// <param name="src"> </param> /// <exception cref="IllegalArgumentException"> 如果src的对象类型与该类型不一�? </exception> /// <exception cref="IllegalStateException"> 如果该对象处于只读状�? </exception> public void copyFrom(IntNumberPropertyObject src) { if (src.propertyType != this.propertyType) { throw new System.ArgumentException("Not the same property type."); } if (!isReadOnly) { this.props.copyFrom(src.props); } else { throw new System.NotSupportedException("PROP_READONLY"); } }
/// <summary> /// 为本身加上或减去将指定参数中的数�? /// </summary> /// <param name="src"> </param> /// <param name="sign"> 1 or -1 (�?�? </param> /// <exception cref="IllegalArgumentException"> 如果src的对象类型与该类型不一�? </exception> /// <exception cref="IllegalStateException"> 如果该对象处于只读状�? </exception> private void addBySign(IntNumberPropertyObject src, int sign) { if (src.propertyType != this.propertyType) { throw new System.ArgumentException("Not the same property type."); } if (!isReadOnly) { for (int i = 0; i < size(); i++) { add(i, sign * src.get(i)); } } else { throw new System.NotSupportedException("PROP_READONLY"); } }
/// <summary> /// 从本身减去将指定参数中的数据 /// </summary> /// <param name="src"> </param> /// <exception cref="IllegalArgumentException"> 如果src的对象类型与该类型不一�? </exception> /// <exception cref="IllegalStateException"> 如果该对象处于只读状�? </exception> public void dec(IntNumberPropertyObject src) { addBySign(src, -1); }
/// <summary> /// 将指定参数中的数据加到本身对应索引中 /// </summary> /// <param name="src"> </param> /// <exception cref="IllegalArgumentException"> 如果src的对象类型与该类型不一�? </exception> /// <exception cref="IllegalStateException"> 如果该对象处于只读状�? </exception> public void add(IntNumberPropertyObject src) { addBySign(src, 1); }