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

📄 numerictransformationoperatorproperty.java

📁 一个数据挖掘软件ALPHAMINERR的整个过程的JAVA版源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 *    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/1/19
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package eti.bi.alphaminer.patch.standard.operation.property;


import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;


import com.prudsys.pdm.Core.MiningAttribute;
import com.prudsys.pdm.Core.MiningDataSpecification;
import com.prudsys.pdm.Core.MiningException;
import com.prudsys.pdm.Core.NumericAttribute;

import eti.bi.alphaminer.core.handler.ICaseHandler;
import eti.bi.alphaminer.operation.operator.DimensionConstants;
import eti.bi.alphaminer.operation.operator.INodeInfo;
import eti.bi.alphaminer.operation.operator.Operator;
import eti.bi.alphaminer.operation.property.OperatorProperty;
import eti.bi.alphaminer.patch.standard.operation.operator.NumericTransformationOperator;
import eti.bi.exception.SysException;
import eti.bi.util.ValueValidator;
import eti.bi.common.Locale.Resource;
/**
 * @author jyung
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */

public class NumericTransformationOperatorProperty extends OperatorProperty
		implements ChangeListener {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private final static String DEFAULT = Resource.srcStr("SelectItem");

	private MiningDataSpecification m_MetaData;

	private JComboBox m_AttributeCombo = new JComboBox();

	private JRadioButton m_RadioCateg = new JRadioButton(Resource.srcStr("m_RadioCateg"));

	private JRadioButton m_RadioDiscret = new JRadioButton(Resource.srcStr("m_RadioDiscret"));

	private ButtonGroup m_RadioGroup1 = new ButtonGroup();

	private ButtonGroup m_RadioGroup2 = new ButtonGroup();

	private JRadioButton m_RadioNoOfBin = new JRadioButton(Resource.srcStr("m_RadioNoOfBin"));

	private JRadioButton m_RadioFixedBinWidth = new JRadioButton(
			Resource.srcStr("m_RadioFixedBinWidth"));

	private JTextField m_NoOfBinText = new JTextField("12");

	private JTextField m_FixedBinWidthText = new JTextField("10.0");

	private JButton m_ButtonReset = new JButton();

	private JButton m_ButtonApply = new JButton();

	private JButton m_ButtonClose = new JButton();

	/**
	 * @throws MiningException
	 * @throws SysException
	 *  
	 */
	public NumericTransformationOperatorProperty(String a_CaseID, String a_NodeID, String a_Name,  INodeInfo a_NodeInfo, ICaseHandler a_CaseHandler)
			throws MiningException, SysException {
		super(a_CaseID, a_NodeID, a_Name,  a_NodeInfo, a_CaseHandler);
		createCatTransformationOperatorProperty();
		this.setTitle(Resource.srcStr("NumericTransformation")+" [" + a_NodeID + "]"); // Added
																	// title
																	// menu by
																	// Joyce
		// 2005/02/17

	}

	private void createCatTransformationOperatorProperty()
			throws MiningException {

		JPanel m_NorthPanel = new JPanel(new BorderLayout());
		m_NorthPanel.setBorder(new EmptyBorder(5, 5, 10, 0));

		m_NorthPanel.add(new JLabel(Resource.srcStr("m_AttributeLabel")+"    "), BorderLayout.WEST);
		m_NorthPanel.add(m_AttributeCombo, BorderLayout.CENTER);
		m_NorthPanel.setPreferredSize(new Dimension(250, 35));

		JPanel m_CenterPanel = new JPanel(new BorderLayout());
		JPanel m_CenterPanel_1 = new JPanel(new GridLayout(2, 1));

		// Panel for discretization options
		JPanel m_CenterPanel_2 = new JPanel(new BorderLayout());
		Border margin = new EmptyBorder(3, 0, 3, 0);
		Border extmargin = new EmptyBorder(3, 5, 6, 0);
		TitledBorder m_border1 = new TitledBorder(new EtchedBorder(), "");
		m_CenterPanel_2.setBorder(new CompoundBorder(extmargin,
				new CompoundBorder(m_border1, margin)));

		m_CenterPanel.add(m_CenterPanel_1, BorderLayout.NORTH);
		m_CenterPanel.add(m_CenterPanel_2, BorderLayout.CENTER);
		m_CenterPanel.add(new JLabel("     "), BorderLayout.WEST);
		m_CenterPanel.setBorder(new EmptyBorder(0, 0, 5, 0));

		m_CenterPanel_1.add(m_RadioCateg);
		m_CenterPanel_1.add(m_RadioDiscret);

		m_FixedBinWidthText.setPreferredSize(DimensionConstants.TEXT_FIELD_DIM);
		m_FixedBinWidthText.setMaximumSize(DimensionConstants.TEXT_FIELD_DIM);
		m_FixedBinWidthText.setMinimumSize(DimensionConstants.TEXT_FIELD_DIM);

		m_NoOfBinText.setPreferredSize(DimensionConstants.TEXT_FIELD_DIM);
		m_NoOfBinText.setMaximumSize(DimensionConstants.TEXT_FIELD_DIM);
		m_NoOfBinText.setMinimumSize(DimensionConstants.TEXT_FIELD_DIM);

		JPanel m_CenterPanel_2a = new JPanel(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();

		c.insets = new Insets(0, 0, 0, 10);
		c.gridx = 0;
		c.gridy = 0;
		c.weightx = 0.0;
		c.fill = GridBagConstraints.NONE;
		c.anchor = GridBagConstraints.LINE_START;
		m_CenterPanel_2a.add(m_RadioNoOfBin, c);

		c.insets = new Insets(0, 0, 0, 10);
		c.gridx = 0;
		c.gridy = 1;
		c.weightx = 0.0;
		c.fill = GridBagConstraints.NONE;
		c.anchor = GridBagConstraints.LINE_START;
		m_CenterPanel_2a.add(m_RadioFixedBinWidth, c);

		c.insets = new Insets(0, 0, 0, 0);

		c.gridx = 1;
		c.gridy = 0;
		c.weightx = 0.0;
		c.fill = GridBagConstraints.NONE;
		c.anchor = GridBagConstraints.LINE_START;
		m_CenterPanel_2a.add(m_NoOfBinText, c);

		c.insets = new Insets(0, 0, 0, 0);

		c.gridx = 1;
		c.gridy = 1;
		c.weightx = 0.0;
		c.fill = GridBagConstraints.NONE;
		c.anchor = GridBagConstraints.LINE_START;
		m_CenterPanel_2a.add(m_FixedBinWidthText, c);

		m_RadioGroup1.add(m_RadioCateg);
		m_RadioGroup1.add(m_RadioDiscret);
		m_RadioGroup2.add(m_RadioNoOfBin);
		m_RadioGroup2.add(m_RadioFixedBinWidth);
		m_RadioCateg.setSelected(true);
		setEnabledDiscret(false);

		m_RadioCateg.addChangeListener(this);
		m_RadioDiscret.addChangeListener(this);

		m_CenterPanel_2.add(m_CenterPanel_2a, BorderLayout.NORTH);

		JPanel buttonPanel = new JPanel();

		m_ButtonReset.setText(Resource.srcStr("m_ButtonReset"));
		m_ButtonApply.setText(Resource.srcStr("m_ButtonApply"));
		m_ButtonClose.setSelected(false);
		m_ButtonClose.setText(Resource.srcStr("m_ButtonClose"));
		buttonPanel.add(m_ButtonApply);
		buttonPanel.add(m_ButtonReset);
		buttonPanel.add(m_ButtonClose);

		m_ButtonReset.addActionListener(this);
		m_ButtonApply.addActionListener(this);
		m_ButtonClose.addActionListener(this);
		m_RadioNoOfBin.addActionListener(this);
		m_RadioFixedBinWidth.addActionListener(this);

		this.getContentPane().add(m_NorthPanel, BorderLayout.NORTH);
		this.getContentPane().add(m_CenterPanel, BorderLayout.CENTER);
		this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
		this.setSize(300, 245);

		initContent();
		getContent();
		this.addInternalFrameListener(this);
	}

	protected void initContent() throws MiningException 
	{
		if (m_ParentOperators.size()>0)
		{
			Operator parentOp = (Operator)m_ParentOperators.elementAt(0);
	
			if (parentOp.getOutputBIObject() != null
					&& parentOp.getOutputBIObject().getBIData() != null) {
				m_MetaData = parentOp.getOutputBIObject().getBIData().getMetaData();
			}
		}
	}

	private void getContent() {
		String value = null;
		int mode = NumericTransformationOperator.CATEGORIZATION;
		int method = NumericTransformationOperator.NUM_BINS;

		/*
		 * set values that independent of the parent node
		 */
		m_RadioCateg.setSelected(true);
		setEnabledDiscret(false);
		m_RadioNoOfBin.setSelected(true);

		value = (String) m_Node.getParameterValue("method");
		if (value != null) {
			method = Integer.parseInt(value);

⌨️ 快捷键说明

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