Ejemplo n.º 1
0
		/// <summary> Creates a new set of instances by copying a 
		/// subset of another set.
		/// 
		/// </summary>
		/// <param name="source">the set of instances from which a subset 
		/// is to be created
		/// </param>
		/// <param name="first">the index of the first instance to be copied
		/// </param>
		/// <param name="toCopy">the number of instances to be copied
		/// </param>
		/// <exception cref="IllegalArgumentException">if first and toCopy are out of range
		/// </exception>
		//@ requires 0 <= first;
		//@ requires 0 <= toCopy;
		//@ requires first + toCopy <= source.numInstances();
		public Instances(Instances source, int first, int toCopy):this(source, toCopy)
		{
			
			if ((first < 0) || ((first + toCopy) > source.numInstances()))
			{
				throw new System.ArgumentException("Parameters first and/or toCopy out " + "of range");
			}
			source.copyInstances(first, this, toCopy);
		}
Ejemplo n.º 2
0
		/// <summary> Constructor copying all instances and references to
		/// the header information from the given set of instances.
		/// 
		/// </summary>
		/// <param name="instances">the set to be copied
		/// </param>
		public Instances(Instances dataset):this(dataset, dataset.numInstances())
		{
			
			dataset.copyInstances(0, this, dataset.numInstances());
		}