use of edu.cmu.tetradapp.ui.model.AlgorithmModels in project tetrad by cmu-phil.
the class GeneralAlgorithmEditor method refreshAlgorithmList.
private void refreshAlgorithmList() {
algoModels.clear();
ButtonModel selectedAlgoType = algoFilterBtnGrp.getSelection();
if (selectedAlgoType != null) {
AlgorithmModels algorithmModels = AlgorithmModels.getInstance();
String algoType = selectedAlgoType.getActionCommand();
if ("all".equals(algoType)) {
if (knowledgeChkBox.isSelected()) {
algorithmModels.getModels().stream().filter(e -> HasKnowledge.class.isAssignableFrom(e.getAlgorithm().getClazz())).forEach(e -> algoModels.addElement(e));
} else {
algorithmModels.getModels().stream().forEach(e -> algoModels.addElement(e));
}
} else {
if (knowledgeChkBox.isSelected()) {
algorithmModels.getModels(AlgType.valueOf(algoType)).stream().filter(e -> HasKnowledge.class.isAssignableFrom(e.getAlgorithm().getClazz())).forEach(e -> algoModels.addElement(e));
} else {
algorithmModels.getModels(AlgType.valueOf(algoType)).stream().forEach(e -> algoModels.addElement(e));
}
}
if (algoModels.isEmpty()) {
paramSetFwdBtn.setEnabled(false);
} else {
algorithmList.setSelectedIndex(0);
paramSetFwdBtn.setEnabled(true);
}
}
scoreComboBox.setEnabled(scoreComboBox.getItemCount() > 0);
}
Aggregations