More contracts on LazyGenotypesContext

This commit is contained in:
Mark DePristo 2011-11-21 09:34:57 -05:00
parent 2e9ecf639e
commit e467b8e1ae
2 changed files with 6 additions and 1 deletions

View File

@ -604,7 +604,7 @@ public class GenotypesContext implements List<Genotype> {
}
}
private final static boolean sameSamples(List<Genotype> genotypes, Collection<String> sampleNamesInOrder) {
protected final static boolean sameSamples(List<Genotype> genotypes, Collection<String> sampleNamesInOrder) {
Set<String> names = new HashSet<String>(sampleNamesInOrder);
if ( names.size() != sampleNamesInOrder.size() )
return false;

View File

@ -65,6 +65,8 @@ public class LazyGenotypesContext extends GenotypesContext {
* to the LazyGenotypesContext holding encoded genotypes data
*/
public interface LazyParser {
@Requires("data != null")
@Ensures("result != null")
public LazyData parse(Object data);
}
@ -78,6 +80,9 @@ public class LazyGenotypesContext extends GenotypesContext {
final Map<String, Integer> sampleNameToOffset;
final List<String> sampleNamesInOrder;
@Requires({"genotypes != null", "sampleNamesInOrder != null", "sampleNameToOffset != null",
"sameSamples(genotypes, sampleNamesInOrder)",
"sameSamples(genotypes, sampleNameToOffset.keySet())"})
public LazyData(final ArrayList<Genotype> genotypes,
final List<String> sampleNamesInOrder,
final Map<String, Integer> sampleNameToOffset) {