From 7459a3e9a872c98faf72ed9796ea5e65a00d2749 Mon Sep 17 00:00:00 2001 From: Walter Date: Tue, 4 Jun 2024 13:31:49 +1200 Subject: [PATCH] merge popFunc viewer #483 --- .../coalescent/populationmodel/ExponentialPopulation.java | 5 +++++ .../src/main/java/lphystudio/viewer/PopSizeFuncViewer.java | 4 ++-- lphy-studio/src/main/java/module-info.java | 3 +-- .../lphystudio.app.graphicalmodelpanel.viewer.Viewer | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lphy-base/src/main/java/lphy/base/evolution/coalescent/populationmodel/ExponentialPopulation.java b/lphy-base/src/main/java/lphy/base/evolution/coalescent/populationmodel/ExponentialPopulation.java index 5796e555..97e5082c 100644 --- a/lphy-base/src/main/java/lphy/base/evolution/coalescent/populationmodel/ExponentialPopulation.java +++ b/lphy-base/src/main/java/lphy/base/evolution/coalescent/populationmodel/ExponentialPopulation.java @@ -135,6 +135,11 @@ public boolean isAnalytical() { return false; //use numerical method here } + @Override + public String toString() { + return "Exponential growth at a rate of " + GrowthRate + + ",\nwith an initial population size (N0) of " + N0; + } public static void main(String[] args) { double GrowthRate = 0.1; diff --git a/lphy-studio/src/main/java/lphystudio/viewer/PopSizeFuncViewer.java b/lphy-studio/src/main/java/lphystudio/viewer/PopSizeFuncViewer.java index 8007f9d4..c45834a0 100644 --- a/lphy-studio/src/main/java/lphystudio/viewer/PopSizeFuncViewer.java +++ b/lphy-studio/src/main/java/lphystudio/viewer/PopSizeFuncViewer.java @@ -24,9 +24,9 @@ public boolean match(Object value) { public JComponent getViewer(Object value) { //TODO create PopulationFunctionComponent((Value) value) if (value instanceof PopulationFunction) { - return new JLabel("PopulationFunction TODO : " + value.toString()); + return new JLabel(value.toString()); } - return new JLabel("Value TODO : " + ((Value) value).value().toString()); + return new JLabel(((Value) value).value().toString()); } @Override public String toString() { diff --git a/lphy-studio/src/main/java/module-info.java b/lphy-studio/src/main/java/module-info.java index f39184a6..c01a3d0e 100644 --- a/lphy-studio/src/main/java/module-info.java +++ b/lphy-studio/src/main/java/module-info.java @@ -30,10 +30,9 @@ // ViewerRegister loads all Viewers uses lphystudio.app.graphicalmodelpanel.viewer.Viewer; // declare what service interface the provider intends to use - provides lphystudio.app.graphicalmodelpanel.viewer.Viewer with lphystudio.viewer.PopSizeFuncViewer; // the core uses hard core to register all internal Viewers, // but extensions need to declare what service interface the provider intends to use for new Viewers. -// provides lphystudio.app.graphicalmodelpanel.viewer.Viewer with lphystudio.app.graphicalmodelpanel.viewer.???Viewer, ...; + provides lphystudio.app.graphicalmodelpanel.viewer.Viewer with lphystudio.viewer.PopSizeFuncViewer; // Note: to adapt with the system not using Java module but using class path, // they need to be declared inside META-INF/services/lphystudio.app.graphicalmodelpanel.viewer.Viewer as well. diff --git a/lphy-studio/src/main/resources/META-INF/services/lphystudio.app.graphicalmodelpanel.viewer.Viewer b/lphy-studio/src/main/resources/META-INF/services/lphystudio.app.graphicalmodelpanel.viewer.Viewer index 7c4b7794..37748b92 100644 --- a/lphy-studio/src/main/resources/META-INF/services/lphystudio.app.graphicalmodelpanel.viewer.Viewer +++ b/lphy-studio/src/main/resources/META-INF/services/lphystudio.app.graphicalmodelpanel.viewer.Viewer @@ -7,4 +7,4 @@ # but extensions need to declare what service interface the provider intends to use for new Viewers. # for example, lphystudio.app.graphicalmodelpanel.viewer.???Viewer -popsizefunc.lphystudio.viewer.PopSizeFuncViewer \ No newline at end of file +lphystudio.viewer.PopSizeFuncViewer \ No newline at end of file