Java Reference
In-Depth Information
13.4.1
Getting the List of Saved Models
As explained for the administration console, once the connection is
obtained, the JDMTestConsole calls start , as presented in the following
code:
1. protected void start(Connection iConnection) {
2.
mDmeConn iConnection;
3.
mModelsCombo.setModel(new DefaultComboBoxModel(getModels()));
4. }
The core of this method is to fill the combo box with the model
names that can be tested, as shown here:
1. private String[] getModels() {
2.
Collection lMiningObjectsNames null;
3.
try {
lMiningObjectsNames mDmeConn.getObjectNames(NamedObject.model);
4.
5.
} catch (JDMException lException) {
6.
throw new UnexpectedJDMException(lException);
7.
}
8.
return (String[])
9.
lMiningObjectsNames.toArray(
10.
new String[lMiningObjectsNames.size()]);
11. }
Obtaining the list of model names is easy. We select all the models
from the MOR using the JDM enumeration NamedObject.model . We
could have checked here whether the models are supervised (that is,
can be tested), but we decided to illustrate the use of the verify
method instead, which should send proper error messages otherwise.
13.4.2
Computing the Test Metrics
When the user clicks on the Test Metrics button, the following code is
executed:
1. private void handlerTestMetrics() {
2.
String lModelName (String) mModelsCombo.getSelectedItem();
3.
Model lModel;
4.
try {
5.
lModel (Model)
6.
mDmeConn.retrieveObject(lModelName, NamedObject.model);
 
Search WWH ::




Custom Search