⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deploymentoperator.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
字号:
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*
 * Created on 2005/2/15
 *
 * $Author$
 * $Date$
 * $Revision$
 *
 */
package eti.bi.alphaminer.operation.operator;

import java.util.Vector;

import eti.bi.alphaminer.core.handler.ICaseHandler;
import eti.bi.alphaminer.operation.operator.Operator;
import eti.bi.exception.SysException;

/**
 * @author kelvinj
 * 
 * All deployment operators should inherit this operator class
 */
public abstract class DeploymentOperator extends Operator {

	
	
	/**
	 * @param a_CaseID
	 * @param a_CaseWindow
	 * @param aOperatorInfo
	 */
	public DeploymentOperator(String a_CaseID, INodeInfo aNodeInfo,
			ICaseHandler aCaseHandler) {
		super(a_CaseID, aNodeInfo, aCaseHandler);
		// TODO Auto-generated constructor stub
	}

	/**
	 * Return true if accept, otherwise, return false;
	 * @see eti.bi.alphaminer.ui.operator.Operator#acceptParent(Operator a_Operator) throws SysException
	 * */
	public boolean acceptParent(Operator a_Operator) throws SysException {
		if(!acceptAsParent(a_Operator)){
			return false;
		}
		
		Vector parentOperators = getParentOperators();

		if (parentOperators == null) {
			throw new SysException("Invalid Parnet Operators.");
		}
		
		// Return true, if there is no parent
		if (parentOperators.size() == 0) {
			return true;
		} else {
			for (int i = 0; i < parentOperators.size(); i++) {
				Operator parentOperator = (Operator) parentOperators
						.elementAt(i);
				if ((parentOperator instanceof ModelOperator)
						&& (a_Operator instanceof ModelOperator)) {
					return false;
				} else if (((parentOperator instanceof InputOperator) || (parentOperator instanceof TransformOperator))
						&& ((a_Operator instanceof InputOperator) || (a_Operator instanceof TransformOperator))) {
					return false;
				}
			}
			return true;
		}
	}
	
	
	/**
	 * Return true if the a_Opeartor could be connected as the parent Deployment
	 * operator allows 1 Modeling Operator (DecisionTree / Logistic Regression)
	 * and 1 Input/Transform operator to be connected as parent
	 * 
	 * @param a_Operator
	 */
	public static boolean acceptAsParent(Operator a_Operator) throws SysException {
		// Do not accept null operator
		if (a_Operator == null) {
			return false;
		}

		// Only accept input, transform and model operators
		if (!(a_Operator instanceof InputOperator)
				&& !(a_Operator instanceof TransformOperator)
				&& !(a_Operator instanceof ModelOperator)) {
			return false;
		}

		return true;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -