예제 #1
0
		/// <summary> Input an instance for filtering. Ordinarily the instance is processed
		/// and made available for output immediately. Some filters require all
		/// instances be read before producing output.
		/// 
		/// </summary>
		/// <param name="instance">the input instance
		/// </param>
		/// <returns> true if the filtered instance may now be
		/// collected with output().
		/// </returns>
		/// <exception cref="IllegalStateException">if no input format has been set.
		/// </exception>
		public override bool input(Instance instance)
		{
			
			if (getInputFormat() == null)
			{
				throw new System.SystemException("No input instance format defined");
			}
			if (m_NewBatch)
			{
				resetQueue();
				m_NewBatch = false;
			}
			if (instance.isMissing(m_AttIndex.Index))
			{
				if (!get_MatchMissingValues())
				{
					push((Instance) instance.copy());
					return true;
				}
				else
				{
					return false;
				}
			}
			if (Numeric)
			{
				if (!m_Values.Invert)
				{
					if (instance.value_Renamed(m_AttIndex.Index) < m_Value)
					{
						push((Instance) instance.copy());
						return true;
					}
				}
				else
				{
					if (instance.value_Renamed(m_AttIndex.Index) >= m_Value)
					{
						push((Instance) instance.copy());
						return true;
					}
				}
			}
			if (Nominal)
			{
				if (m_Values.isInRange((int) instance.value_Renamed(m_AttIndex.Index)))
				{
					Instance temp = (Instance) instance.copy();
					if (get_ModifyHeader())
					{
						temp.setValue(m_AttIndex.Index, m_NominalMapping[(int) instance.value_Renamed(m_AttIndex.Index)]);
					}
					push(temp);
					return true;
				}
			}
			return false;
		}