From a8234302f0224fa086ba8e1ce3b3311597d9c8d7 Mon Sep 17 00:00:00 2001 From: Marcel Kronfeld Date: Mon, 4 May 2009 15:45:52 +0000 Subject: [PATCH] Improve handling of externally set initial population in PSO - adding a translation method. --- src/eva2/server/go/enums/PSOTopologyEnum.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/eva2/server/go/enums/PSOTopologyEnum.java b/src/eva2/server/go/enums/PSOTopologyEnum.java index ea9fb77e..451c2fa0 100644 --- a/src/eva2/server/go/enums/PSOTopologyEnum.java +++ b/src/eva2/server/go/enums/PSOTopologyEnum.java @@ -29,4 +29,22 @@ public enum PSOTopologyEnum { * */ random; + + /** + * A method to translate the "old" integer tags into the enum type. + * @param oldID + * @return + */ + public static PSOTopologyEnum translateOldID(int oldID) { + switch (oldID) { + case 0: return linear; + case 1: return grid; + case 2: return star; + case 3: return multiSwarm; + case 4: return tree; + case 5: return hpso; + case 6: return random; + } + return random; + } }