Mentions légales du service

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

- corrected two bugs which prevented drop to work

parent 4b689a74
No related branches found
No related tags found
No related merge requests found
...@@ -102,6 +102,7 @@ public class OntologyNetworkWeakener { ...@@ -102,6 +102,7 @@ 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 );
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 );
OntologyNetwork newon = new BasicOntologyNetwork(); OntologyNetwork newon = new BasicOntologyNetwork();
...@@ -111,9 +112,12 @@ public class OntologyNetworkWeakener { ...@@ -111,9 +112,12 @@ public class OntologyNetworkWeakener {
Set<Alignment> alignments = on.getAlignments(); Set<Alignment> alignments = on.getAlignments();
int size = alignments.size(); int size = alignments.size();
ArrayList<Alignment> array = new ArrayList<Alignment>( size ); ArrayList<Alignment> array = new ArrayList<Alignment>( size );
for ( Alignment al : alignments ){
array.add( al );
}
Collections.shuffle( array ); Collections.shuffle( array );
for ( int i = size - (int)(n*size); i > 0; i-- ) { for ( int i = size - (int)(n*size); i > 0; i-- ) {
on.addAlignment( array.get( i ) ); newon.addAlignment( array.get( i ) );
} }
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