forked from bioclipse/bioclipse.ds
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started refactoring of DSView to be based on
ICDKMolecule instead of JCP.
- Loading branch information
Showing
2 changed files
with
455 additions
and
414 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
plugins/net.bioclipse.ds.ui/src/net/bioclipse/ds/ui/VotingConsensus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.