/** * Gets sample associated with this sampleName, or null if none is found * * @param sampleName * @return */ public Genotype get(final String sampleName) { Integer offset = getSampleI(sampleName); return offset == null ? null : getGenotypes().get(offset); }
/** * Create a freshly allocated GenotypeContext containing the genotypes in toCopy * * @param toCopy the GenotypesContext to copy * @return an mutable GenotypeContext containing genotypes */ public static final GenotypesContext copy(final GenotypesContext toCopy) { return create(new ArrayList<Genotype>(toCopy.getGenotypes())); }
/** * Create a freshly allocated GenotypeContext containing the genotypes in toCopy * * @param toCopy the GenotypesContext to copy * @return an mutable GenotypeContext containing genotypes */ public static final GenotypesContext copy(final GenotypesContext toCopy) { return create(new ArrayList<Genotype>(toCopy.getGenotypes())); }
protected void ensureSampleOrdering() { if ( sampleNamesInOrder == null ) { sampleNamesInOrder = new ArrayList<String>(size()); for ( int i = 0; i < size(); i++ ) { sampleNamesInOrder.add(getGenotypes().get(i).getSampleName()); } Collections.sort(sampleNamesInOrder); } }
protected void ensureSampleOrdering() { if ( sampleNamesInOrder == null ) { sampleNamesInOrder = new ArrayList<String>(size()); for ( int i = 0; i < size(); i++ ) { sampleNamesInOrder.add(getGenotypes().get(i).getSampleName()); } Collections.sort(sampleNamesInOrder); } }
@Ensures({"sampleNamesInOrder != null"}) protected void ensureSampleOrdering() { if ( sampleNamesInOrder == null ) { sampleNamesInOrder = new ArrayList<String>(size()); for ( int i = 0; i < size(); i++ ) { sampleNamesInOrder.add(getGenotypes().get(i).getSampleName()); } Collections.sort(sampleNamesInOrder); } }
@Override public Genotype set(final int i, final Genotype genotype) { checkImmutability(); final Genotype prev = getGenotypes().set(i, genotype); invalidateSampleOrdering(); if ( sampleNameToOffset != null ) { // update the name map by removing the old entry and replacing it with the new one sampleNameToOffset.remove(prev.getSampleName()); sampleNameToOffset.put(genotype.getSampleName(), i); } return prev; }
@Override public Genotype set(final int i, final Genotype genotype) { checkImmutability(); final Genotype prev = getGenotypes().set(i, genotype); invalidateSampleOrdering(); if ( sampleNameToOffset != null ) { // update the name map by removing the old entry and replacing it with the new one sampleNameToOffset.remove(prev.getSampleName()); sampleNameToOffset.put(genotype.getSampleName(), i); } return prev; }
@Override public Genotype set(final int i, final Genotype genotype) { checkImmutability(); final Genotype prev = getGenotypes().set(i, genotype); invalidateSampleOrdering(); if ( sampleNameToOffset != null ) { // update the name map by removing the old entry and replacing it with the new one sampleNameToOffset.remove(prev.getSampleName()); sampleNameToOffset.put(genotype.getSampleName(), i); } return prev; }
/** * See for important warning {@link #remove(int)} * @param o * @return */ @Override public boolean remove(final Object o) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().remove(o); }
@Override public boolean removeAll(final Collection<?> objects) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().removeAll(objects); }
/** * Create a freshly allocated GenotypeContext containing the genotypes in toCopy * * @param toCopy the GenotypesContext to copy * @return an mutable GenotypeContext containing genotypes */ @Requires({"toCopy != null"}) @Ensures({"result != null"}) public static final GenotypesContext copy(final GenotypesContext toCopy) { return create(new ArrayList<Genotype>(toCopy.getGenotypes())); }
@Override public void clear() { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); getGenotypes().clear(); }
@Override public boolean removeAll(final Collection<?> objects) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().removeAll(objects); }
@Override public void clear() { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); getGenotypes().clear(); }
@Override public void clear() { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); getGenotypes().clear(); }
/** * See for important warning {@link this.remove(Integer)} * @param o * @return */ @Override public boolean remove(final Object o) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().remove(o); }
@Override public boolean retainAll(final Collection<?> objects) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().retainAll(objects); }
@Override public boolean retainAll(final Collection<?> objects) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().retainAll(objects); }
@Override public boolean retainAll(final Collection<?> objects) { checkImmutability(); invalidateSampleNameMap(); invalidateSampleOrdering(); return getGenotypes().retainAll(objects); }