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
Branches
Tags
No related merge requests found
......@@ -102,6 +102,7 @@ public class OntologyNetworkWeakener {
* Returns a brand new BasicOntologyNetwork (with the initial alignments)
*/
public static OntologyNetwork dropAlignments( OntologyNetwork on, double n ) throws AlignmentException {
System.err.println( " >>>> "+n );
if ( n < 0. || n > 1. )
throw new AlignmentException( "Argument must be between 0 and 1.: "+n );
OntologyNetwork newon = new BasicOntologyNetwork();
......@@ -111,9 +112,12 @@ public class OntologyNetworkWeakener {
Set<Alignment> alignments = on.getAlignments();
int size = alignments.size();
ArrayList<Alignment> array = new ArrayList<Alignment>( size );
for ( Alignment al : alignments ){
array.add( al );
}
Collections.shuffle( array );
for ( int i = size - (int)(n*size); i > 0; i-- ) {
on.addAlignment( array.get( i ) );
newon.addAlignment( array.get( i ) );
}
return newon;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment