From a13fd99ea0e21e02f50b7aad6418cbc53f7225e0 Mon Sep 17 00:00:00 2001 From: ctrebeau <ctrebeau@pasteur.fr> Date: Tue, 6 Oct 2020 16:26:55 +0200 Subject: [PATCH] Code to test starting OS size --- .../surfaceConstruction/element/os/OS.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/os/OS.java b/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/os/OS.java index 6834bcf3..faa34402 100644 --- a/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/os/OS.java +++ b/src/main/java/fr/pasteur/ida/zellige/surfaceConstruction/element/os/OS.java @@ -11,6 +11,7 @@ import java.util.*; public class OS extends ArrayList< Coordinate > { private static TreeSet <Integer> list = new TreeSet<>(); + private static TreeMap<Integer, Integer> occ = new TreeMap<>(); private static int startingSize; @@ -38,6 +39,8 @@ public class OS extends ArrayList< Coordinate > public void set( ) { list.add( this.size() ); + Integer j = occ.get(this.size() ); + occ.put( this.size(), ( j == null ) ? 1 : j + 1 ); /* Not necessary for the program.*/ this.name = count; /*----------------*/ @@ -97,7 +100,6 @@ public class OS extends ArrayList< Coordinate > this.start = false; } - /** * Sets the visited parameter to the specified value. * @@ -153,7 +155,7 @@ public static void setStartingStatus(int dimension) startingSize = 0; if ( dimension == 0 ) { - for ( int i = 0; list.size() > 10 && i <= list.size() / 4; i++ ) + for ( int i = 0; list.size() > 20 && i <= list.size()/2 ;i++ ) { list.remove( list.last() ); } @@ -167,8 +169,12 @@ public static void setStartingStatus(int dimension) } startingSize = list.last(); list = new TreeSet<>(); - } + }} + + public static void setStartingStatusStats(int dimension) + { + startingSize = list.last(); } @@ -181,4 +187,9 @@ public static void setStartingStatus(int dimension) { OS.count = count; } + + public static TreeMap< Integer, Integer > getOcc() + { + return occ; + } } -- GitLab