Skip to content

Commit

Permalink
Merge pull request #1752 from cmu-phil/joe_bayes_im
Browse files Browse the repository at this point in the history
Final touches, Bayes estimator refactor.
  • Loading branch information
jdramsey authored Apr 1, 2024
2 parents 6ebe356 + e94dc22 commit b9dd539
Show file tree
Hide file tree
Showing 23 changed files with 323 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ private static class ChooserTreeModel implements TreeModel {

public ChooserTreeModel(List<SessionNodeModelConfig> configs) {
for (SessionNodeModelConfig config : configs) {
String category = config.getCategory();
String category = config.category();
if (category == null) {
throw new NullPointerException("No Category name associated with model: " + config.getModel());
throw new NullPointerException("No Category name associated with model: " + config.model());
}

if ("Unlisted".equals(category)) {
Expand All @@ -316,7 +316,7 @@ public ChooserTreeModel(List<SessionNodeModelConfig> configs) {
}

List<ModelWrapper> models = this.map.computeIfAbsent(category, k -> new LinkedList<>());
models.add(new ModelWrapper(config.getName(), config.getModel()));
models.add(new ModelWrapper(config.name(), config.model()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public void setModelConfigs(List<SessionNodeModelConfig> configs) {
List<ClassWrapper> wrapperList = new LinkedList<>();

for (SessionNodeModelConfig config : configs) {
Class<?> modelClass = config.getModel();
Class<?> modelClass = config.model();
if (!(UnlistedSessionModel.class.isAssignableFrom(modelClass))) {
wrapperList.add(new ClassWrapper(modelClass, config.getName()));
wrapperList.add(new ClassWrapper(modelClass, config.name()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ private String getAcronym() {
return modelClass.getSimpleName();
}

return modelConfig.getAcronym();
return modelConfig.acronym();
}
}

Expand Down Expand Up @@ -297,7 +297,7 @@ private void launchEditorVisit() {

ModificationRegistery.registerEditor(sessionNode, editor);

String descrip = modelConfig.getName();
String descrip = modelConfig.name();
editor.setName(getName() + " (" + descrip + ")");

EditorWindow editorWindow = new EditorWindow(editor, editor.getName(), "Done", cloned, this);
Expand Down Expand Up @@ -1100,7 +1100,7 @@ public boolean editParameters(Class<?> modelClass, Parameters params,
JComponent editor = (JComponent) paramEditor;
SessionNodeWrapper nodeWrapper = (SessionNodeWrapper) getModelNode();
String buttonType = nodeWrapper.getButtonType();
editor.setName(buttonType + " Structure Editor");
editor.setName(buttonType + " Parameter Editor");
Component centeringComp = this;

int ret = JOptionPane.showOptionDialog(centeringComp, editor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,31 @@ public interface SessionNodeModelConfig {
* @return the category that this model config belongs to or null if there isn't one. This allows you to organize
* models into various groupings.
*/
String getCategory();
String category();


/**
* Returns the model class associated with the configuration.
*
* @return the model class
*/
Class<?> getModel();
Class<?> model();


/**
* <p>getName.</p>
*
* @return a descriptive name for the model.
*/
String getName();
String name();


/**
* <p>getAcronym.</p>
*
* @return the acronym for the model.
*/
String getAcronym();
String acronym();


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void showPermissibleParentsDialog(Class<?> modelClass,

StringBuilder b = new StringBuilder();
b.append("<html>");
b.append("The combinations of parent models you can use for ").append(modelConfig.getName()).append(" are:");
b.append("The combinations of parent models you can use for ").append(modelConfig.name()).append(" are:");

for (int i = 0; i < parentCombinations.length; i++) {
String[] parentCombination = parentCombinations[i];
Expand All @@ -88,7 +88,7 @@ public static void showPermissibleParentsDialog(Class<?> modelClass,
final int messageType = JOptionPane.INFORMATION_MESSAGE;

JOptionPane.showMessageDialog(centeringComp, b.toString(),
"Information on \"" + modelConfig.getName() + "\"", messageType);
"Information on \"" + modelConfig.name() + "\"", messageType);
}

/**
Expand Down Expand Up @@ -172,7 +172,7 @@ private static String getModelName(Class<?> model) {
return null;
}
SessionNodeModelConfig modelConfig = config.getModelConfig(model);
return modelConfig.getName();
return modelConfig.name();
}


Expand Down
Loading

0 comments on commit b9dd539

Please sign in to comment.