public void run() {
// Copy the current state of things
m_Log.statusMessage(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_Log_StatusMessage_Text_First"));
Instances inst = new Instances(m_Instances);
Associator associator = (Associator) m_AssociatorEditor.getValue();
StringBuffer outBuff = new StringBuffer();
String name = (new SimpleDateFormat("HH:mm:ss - "))
.format(new Date());
String cname = associator.getClass().getName();
if (cname.startsWith("weka.associations.")) {
name += cname.substring("weka.associations.".length());
} else {
name += cname;
}
String cmd = m_AssociatorEditor.getValue().getClass().getName();
if (m_AssociatorEditor.getValue() instanceof OptionHandler)
cmd += " " + Utils.joinOptions(((OptionHandler) m_AssociatorEditor.getValue()).getOptions());
try {
// Output some header information
m_Log.logMessage(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_Log_LogMessage_Text_First") + cname);
m_Log.logMessage(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_Log_LogMessage_Text_Second") + cmd);
if (m_Log instanceof TaskLogger) {
((TaskLogger)m_Log).taskStarted();
}
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_First"));
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Second") + cname);
if (associator instanceof OptionHandler) {
String [] o = ((OptionHandler) associator).getOptions();
outBuff.append(" " + Utils.joinOptions(o));
}
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Third"));
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Fourth") + inst.relationName() + '\n');
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Sixth") + inst.numInstances() + '\n');
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Seventh") + inst.numAttributes() + '\n');
if (inst.numAttributes() < 100) {
for (int i = 0; i < inst.numAttributes(); i++) {
outBuff.append(" " + inst.attribute(i).name()
+ '\n');
}
} else {
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Eighth"));
}
m_History.addResult(name, outBuff);
m_History.setSingle(name);
// Build the model and output it.
m_Log.statusMessage(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_Log_StatusMessage_Text_Second"));
associator.buildAssociations(inst);
outBuff.append(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_OutBuffer_Text_Nineth"));
outBuff.append(associator.toString() + '\n');
m_History.updateResult(name);
m_Log.logMessage(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_Log_LogMessage_Text_Third") + cname);
m_Log.statusMessage(Messages.getInstance().getString("AssociationsPanel_StartAssociator_Run_Log_StatusMessage_Text_Third"));
} catch (Exception ex) {
m_Log.logMessage(ex.getMessage());