Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3cf30085 authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- added drop by n correspondences in addition to by n% correspondences

parent fcdfe558
No related branches found
No related tags found
No related merge requests found
/* /*
* $Id$ * $Id$
* *
* Copyright (C) INRIA, 2009 * Copyright (C) INRIA, 2009-2010
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
...@@ -102,9 +102,16 @@ public class OntologyNetworkWeakener { ...@@ -102,9 +102,16 @@ public class OntologyNetworkWeakener {
* Returns a brand new BasicOntologyNetwork (with the initial alignments) * Returns a brand new BasicOntologyNetwork (with the initial alignments)
*/ */
public static OntologyNetwork dropAlignments( OntologyNetwork on, double n ) throws AlignmentException { public static OntologyNetwork dropAlignments( OntologyNetwork on, double n ) throws AlignmentException {
System.err.println( " >>>> "+n ); //System.err.println( " >>>> "+n );
if ( n < 0. || n > 1. ) if ( n < 0. || n > 1. )
throw new AlignmentException( "Argument must be between 0 and 1.: "+n ); throw new AlignmentException( "Argument must be between 0 and 1.: "+n );
return dropAlignments( on, (int)(n*on.getAlignments().size()) );
}
public static OntologyNetwork dropAlignments( OntologyNetwork on, int n ) throws AlignmentException {
//System.err.println( " >>>> "+n );
if ( n < 0 || n > on.getAlignments().size() )
throw new AlignmentException( "Argument must be a positive integer: "+n );
OntologyNetwork newon = new BasicOntologyNetwork(); OntologyNetwork newon = new BasicOntologyNetwork();
for ( URI ontouri : on.getOntologies() ){ for ( URI ontouri : on.getOntologies() ){
newon.addOntology( ontouri ); newon.addOntology( ontouri );
...@@ -121,4 +128,6 @@ public class OntologyNetworkWeakener { ...@@ -121,4 +128,6 @@ public class OntologyNetworkWeakener {
} }
return newon; return newon;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment