📄 normalizationoperatorproperty.java
字号:
throw new MiningException("Meta data of the node is null");
}
}
// calcMinMaxValues(m_msd);
}
private void getContent() {
String value = null;
int mode = NormalizeOperator.LINEAR_NORMAL;
/*
* Set values that independent of the parent node
*/
m_RadioLinear.setSelected(true);
m_RadioAsIs.setSelected(true);
setEnabledLinear(true);
value = (String) m_Node.getParameterValue("mode");
if (value != null) {
mode = Integer.parseInt(value);
switch (mode) {
case NormalizeOperator.ZET_NORMAL:
setEnabledLinear(false);
m_RadioZeta.setSelected(true);
break;
case NormalizeOperator.LINEAR_NORMAL:
setEnabledLinear(true);
m_RadioLinear.setSelected(true);
}
}
//BAT modification
//<<tyleung 24/3/2005
// value = m_Node.getParameterValue("outlier");
// if (value != null)
// {
// if (value
// .equalsIgnoreCase(LinearNormal.OUTLIER_TREATMENT_METHOD_asExtremeValues))
// {
//
// m_RadioExtremeVal.setSelected(true);
// } else if (value
// .equalsIgnoreCase(LinearNormal.OUTLIER_TREATMENT_METHOD_asMissingValues))
// m_RadioMissingVal.setSelected(true);
// else
// m_RadioAsIs.setSelected(true);
// }
// value = m_Node.getParameterValue("min");
// if (value != null)
// m_MinText.setText(value);
// else
// m_MinText.setText("");
// // m_MinText.setText(Double.toString(m_MinValues[attrIndex-1]));
//
// value = m_Node.getParameterValue("max");
// if (value != null)
// m_MaxText.setText(value);
// else
// m_MaxText.setText("");
// // m_MaxText.setText(Double.toString(m_MaxValues[attrIndex-1]));
//tyleung 24/3/2005>>
value = (String) m_Node.getParameterValue("lowerBound");
if (value != null)
m_LowerBoundText.setText(value);
else
m_LowerBoundText.setText("0.0");
value = (String) m_Node.getParameterValue("upperBound");
if (value != null)
m_UpperBoundText.setText(value);
else
m_UpperBoundText.setText("1.0");
/*
* set values that independent of the parent node
*/
if (m_MetaData == null || m_Node == null)
return;
int m_Column = m_MetaData.getAttributesNumber();
if (m_Column == 0)
return;
MiningAttribute[] miningAttributes = m_MetaData.getAttributesArray();
MiningAttribute attribute = null;
String name = null;
int index = 0;
int attrIndex = 0;
m_AttributeCombo.removeAllItems();
m_AttributeCombo.addItem(DEFAULT);
for (int i = 0; i < m_Column; i++) {
value = (String) m_Node.getParameterValue("target");
attribute = miningAttributes[i];
name = attribute.getName();
if (attribute instanceof NumericAttribute) {
m_AttributeCombo.addItem(name);
index++;
if (value != null && value.equalsIgnoreCase(name)) {
attrIndex = index;
}
}
}
m_AttributeCombo.setSelectedIndex(attrIndex);
// if(mAtt == null || !(mAtt instanceof NumericAttribute)){
// m_AttributeCombo.setSelectedIndex(0);
// m_RadioLinear.setSelected(true);
// m_RadioAsIs.setSelected(true);
// setEnabledLinear(true);
// m_MinText.setText("");
// m_MaxText.setText("");
// m_LowerBoundText.setText("0.0");
// m_UpperBoundText.setText("1.0");
// }
}
private boolean setContent() {
if (!validateProperty())
return false;
String attrName = null;
int mode = -1;
String lowerBound = null;
String upperBound = null;
//get target attribute name
attrName = (String) m_AttributeCombo.getSelectedItem();
//set the normalization method
if (m_RadioLinear.isSelected()) {
mode = NormalizeOperator.LINEAR_NORMAL;
} else if (m_RadioZeta.isSelected()) {
mode = NormalizeOperator.ZET_NORMAL;
}
//get the outlier treatment method
// if (m_RadioAsIs.isSelected())
// {
// outlier = LinearNormal.OUTLIER_TREATMENT_METHOD_asIs;
// } else if (m_RadioMissingVal.isSelected())
// {
// outlier = LinearNormal.OUTLIER_TREATMENT_METHOD_asMissingValues;
// } else if (m_RadioExtremeVal.isSelected())
// {
// outlier = LinearNormal.OUTLIER_TREATMENT_METHOD_asExtremeValues;
// }
lowerBound = m_LowerBoundText.getText().trim();
upperBound = m_UpperBoundText.getText().trim();
// << added by Joyce 2005/03/17 to clear result
// Operator op = m_ParentPanel.getOperator(m_NodeID);
/*Operator op = null;
try {
op = CaseHandler.getOperator(m_CaseID, m_NodeID);
} catch (SysException e) {
// TODO Auto-generated catch block
// Do Nothing
}*/
// ((NormalizeOperator) op).clearResult();
clearOperatorTempResult();
//>>
m_Node.getParameters().remove("target");
m_Node.getParameters().remove("mode");
// m_Node.getParameters().remove("outlier");
m_Node.getParameters().remove("lowerBound");
m_Node.getParameters().remove("upperBound");
// m_Node.getParameters().remove("min");
// m_Node.getParameters().remove("max");
m_Node.setParameterValue("target", attrName);
m_Node.setParameterValue("mode", Integer.toString(mode));
// m_Node.setParameterValue("outlier", outlier);
// m_Node.setParameterValue("min", min);
// m_Node.setParameterValue("max", max);
m_Node.setParameterValue("lowerBound", lowerBound);
m_Node.setParameterValue("upperBound", upperBound);
clearOperatorTempResult();
return true;
}
private void setEnabledLinear(boolean a_Flag) {
//input control
m_LowerBoundText.setEnabled(a_Flag);
m_UpperBoundText.setEnabled(a_Flag);
m_MinText.setEnabled(a_Flag);
m_MaxText.setEnabled(a_Flag);
//Radio control
m_RadioMissingVal.setEnabled(a_Flag);
m_RadioExtremeVal.setEnabled(a_Flag);
m_RadioAsIs.setEnabled(a_Flag);
}
private boolean validateProperty() {
String message = "";
boolean setFocus = false;
if (m_AttributeCombo.getSelectedIndex() <= 0) {
m_AttributeCombo.requestFocus();
setFocus = true;
message += Resource.srcStr("SelectAttribute");
m_MessageDialog.showWarning(message, Resource.srcStr("InvalidValueMessage"));
return false;
}
if (m_RadioLinear.isSelected()) {
String lowerBound = m_LowerBoundText.getText().trim();
if (!ValueValidator.isDouble(lowerBound)) {
if (!setFocus) {
m_LowerBoundText.requestFocus();
setFocus = true;
}
m_LowerBoundText.setText(null);
message += Resource.srcStr("LowerMessage");
m_MessageDialog.showWarning(message, Resource.srcStr("InvalidValueMessage"));
return false;
}
String upperBound = m_UpperBoundText.getText().trim();
if (!ValueValidator.isDouble(upperBound)) {
if (!setFocus) {
m_UpperBoundText.requestFocus();
setFocus = true;
}
m_UpperBoundText.setText(null);
message += Resource.srcStr("UpperMessage");
m_MessageDialog.showWarning(message, Resource.srcStr("InvalidValueMessage"));
return false;
}
if (ValueValidator.isDouble(lowerBound)
&& ValueValidator.isDouble(upperBound)
&& !ValueValidator.largerThan(upperBound, Double
.parseDouble(lowerBound), false)) {
if (!setFocus) {
m_LowerBoundText.requestFocus();
setFocus = true;
}
m_LowerBoundText.setText(null);
m_UpperBoundText.setText(null);
message += Resource.srcStr("UpperMessage1");
m_MessageDialog.showWarning(message, Resource.srcStr("InvalidValueMessage"));
return false;
}
// String min = m_MinText.getText().trim();
// if (!ValueValidator.isDouble(min))
// {
// if (!setFocus)
// {
// m_MinText.requestFocus();
// setFocus = true;
// }
// m_MinText.setText(null);
// message += "Minimum should be a double\n";
// MessageDialog.showWarning(message, "Invalid input value");
// return false;
// }
//
// String max = m_MaxText.getText().trim();
// if (!ValueValidator.isDouble(max))
// {
// if (!setFocus)
// {
// m_MaxText.requestFocus();
// setFocus = true;
// }
// m_MaxText.setText(null);
// message += "Maximum should be a double\n";
// MessageDialog.showWarning(message, "Invalid input value");
// return false;
// }
//
// if (ValueValidator.isDouble(min)
// && ValueValidator.isDouble(max)
// && !ValueValidator.largerThan(max, Double.parseDouble(min),
// false))
// {
// if (!setFocus)
// {
// m_MinText.requestFocus();
// setFocus = true;
// }
// m_MinText.setText(null);
// m_MaxText.setText(null);
// message += "Maximum should not be larger than minimum\n";
// MessageDialog.showWarning(message, "Invalid input value");
// return false;
// }
}
// if (!message.equals("")) {
// MessageDialog.showWarning(message, "Invalid input values");
// return false;
// } else
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -