Skip to content

Commit

Permalink
Started refactoring of DSView to be based on
Browse files Browse the repository at this point in the history
ICDKMolecule instead of JCP.
  • Loading branch information
olas committed Jun 28, 2010
1 parent 22e8273 commit 09f22c5
Show file tree
Hide file tree
Showing 2 changed files with 455 additions and 414 deletions.
@@ -0,0 +1,61 @@
package net.bioclipse.ds.ui;

import java.util.List;

import net.bioclipse.ds.model.ITestResult;
import net.bioclipse.ds.model.TestRun;

public class VotingConsensus {



/**
* A simple consensus voting.
* TODO: Implement custom solutions for this.
* @return
*/
public static int getConsensusFromTestRuns(List<TestRun> activeTestRuns) {

int numpos=0;
int numneg=0;
int numinc=0;

if (activeTestRuns==null)
return ITestResult.INCONCLUSIVE;

for (TestRun tr : activeTestRuns){
//Only count non-informative and included testruns
if ((!(tr.getTest().isInformative()))
&& (!(tr.getTest().isExcluded()))){

if (tr.getStatus()==TestRun.FINISHED){
if (tr.getConsensusStatus()==ITestResult.POSITIVE)
numpos++;
else if (tr.getConsensusStatus()==ITestResult.NEGATIVE)
numneg++;
else if (tr.getConsensusStatus()==ITestResult.INCONCLUSIVE)
numinc++;
}

}
}

//If no positive results:
if (numpos==0)
return ITestResult.NEGATIVE;

//If at least one but equal:
else if (numpos==numneg)
return ITestResult.INCONCLUSIVE;

//If at least one but more pos than neg:
else if (numpos>numneg)
return ITestResult.POSITIVE;

//In all other cases:
else
return ITestResult.NEGATIVE;

}

}

0 comments on commit 09f22c5

Please sign in to comment.