From 226365bd6a0f56143ffbce7379857ff3e126fbaf Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Mon, 7 Apr 2014 15:58:30 +0100 Subject: Refactoring resources for (hopefully) the last time --- .../backend/resources/ModifiableResources.java | 17 ++++++++++ src/jcgp/backend/resources/Resources.java | 36 ++++++++++------------ 2 files changed, 34 insertions(+), 19 deletions(-) (limited to 'src/jcgp/backend/resources') diff --git a/src/jcgp/backend/resources/ModifiableResources.java b/src/jcgp/backend/resources/ModifiableResources.java index 90c2f03..a221f73 100644 --- a/src/jcgp/backend/resources/ModifiableResources.java +++ b/src/jcgp/backend/resources/ModifiableResources.java @@ -40,4 +40,21 @@ public class ModifiableResources extends Resources { this.console = console; } + /* + * Console functionality + */ + public void println(String s) { + System.out.println(s); + if (console != null) { + console.println(s); + } + } + + public void print(String s) { + System.out.print(s); + if (console != null) { + console.print(s); + } + } + } diff --git a/src/jcgp/backend/resources/Resources.java b/src/jcgp/backend/resources/Resources.java index d1f396a..13e0c51 100644 --- a/src/jcgp/backend/resources/Resources.java +++ b/src/jcgp/backend/resources/Resources.java @@ -266,31 +266,29 @@ public class Resources { return functionSet; } -// /* -// * Test cases -// */ -// public TestCase getTestCase(int index) { -// return testCases[index]; -// } -// -// public int getTestCaseCount() { -// return testCases.length; -// } - /* * Console functionality + * These are affected by parameter report */ - public void println(String s) { - System.out.println(s); - if (console != null) { - console.println(s); + public void reportln(String s) { + if (getInt("report") > 0) { + if (getInt("currentGen") % getInt("report") == 0) { + System.out.println(s); + if (console != null) { + console.println(s); + } + } } } - public void print(String s) { - System.out.print(s); - if (console != null) { - console.print(s); + public void report(String s) { + if (getInt("report") > 0) { + if (getInt("currentGen") % getInt("report") == 0) { + System.out.print(s); + if (console != null) { + console.print(s); + } + } } } } \ No newline at end of file -- cgit v1.2.3