From aa48f394e6d96a7378a58c9921602b6c7ce01021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Mon, 13 Jul 2009 17:14:21 +0000 Subject: [PATCH] - added debugging utility (displayCache) --- .../inrialpes/exmo/align/onto/OntologyCache.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/fr/inrialpes/exmo/align/onto/OntologyCache.java b/src/fr/inrialpes/exmo/align/onto/OntologyCache.java index 452b0d09..2fa3ebfa 100644 --- a/src/fr/inrialpes/exmo/align/onto/OntologyCache.java +++ b/src/fr/inrialpes/exmo/align/onto/OntologyCache.java @@ -54,6 +54,7 @@ public class OntologyCache <O extends LoadedOntology> { public void recordOntology( URI uri, O ontology ){ ontologies.put( uri, ontology ); ontologyUris.put( ontology.getURI(), ontology ); + //displayCache(); } public O getOntology( URI uri ){ @@ -65,12 +66,26 @@ public class OntologyCache <O extends LoadedOntology> { } public void unloadOntology( URI uri, O ontology ){ + //System.err.println("UNLOAD"); + //displayCache(); O o = ontologyUris.get(uri); o.unload(); ontologyUris.remove( uri ); ontologies.remove( uri ); } + /* debugging utility */ + public void displayCache(){ + System.err.println("CACHE: "+ontologies.size()+"/"+ontologyUris.size()+" elements cached"); + for( Enumeration<URI> e = ontologies.keys(); e.hasMoreElements(); ){ + URI u = e.nextElement(); + LoadedOntology o = ontologies.get( u ); + System.err.println( " "+u ); + System.err.println( " "+o.getURI() ); + System.err.println( " --> "+o+" ("+o.getOntology()+")" ); + } + }; + public void clear(){ for ( LoadedOntology o : ontologies.values() ){ o.unload(); -- GitLab