/** * A convenience access for the number of elements. * @param vc * @param value * @return the number of encoded elements, either from the fixed number * it has, from the VC, or from the value itself. */ public final int numElements(final VariantContext vc, final Object value) { if ( hasConstantNumElements() ) return numElements(); else if ( hasContextDeterminedNumElements() ) return numElements(vc); else return numElements(value); }
/** * A convenience access for the number of elements. * @param vc * @param value * @return the number of encoded elements, either from the fixed number * it has, from the VC, or from the value itself. */ public final int numElements(final VariantContext vc, final Object value) { if ( hasConstantNumElements() ) return numElements(); else if ( hasContextDeterminedNumElements() ) return numElements(vc); else return numElements(value); }
/** * A convenience access for the number of elements, returning * the number of encoded elements, either from the fixed number * it has, from the VC, or from the value itself. * @param vc * @param value * @return */ @Ensures("result >= 0") public final int numElements(final VariantContext vc, final Object value) { if ( hasConstantNumElements() ) return numElements(); else if ( hasContextDeterminedNumElements() ) return numElements(vc); else return numElements(value); }
@Override public void start(final BCF2Encoder encoder, final VariantContext vc) throws IOException { // writes the key information super.start(encoder, vc); // only update if we need to if ( ! getFieldEncoder().hasConstantNumElements() ) { if ( getFieldEncoder().hasContextDeterminedNumElements() ) // we are cheap -- just depends on genotype of allele counts nValuesPerGenotype = getFieldEncoder().numElements(vc); else // we have to go fishing through the values themselves (expensive) nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } encoder.encodeType(nValuesPerGenotype, encodingType); }
@Override public void start(final BCF2Encoder encoder, final VariantContext vc) throws IOException { // writes the key information super.start(encoder, vc); // only update if we need to if ( ! getFieldEncoder().hasConstantNumElements() ) { if ( getFieldEncoder().hasContextDeterminedNumElements() ) // we are cheap -- just depends on genotype of allele counts nValuesPerGenotype = getFieldEncoder().numElements(vc); else // we have to go fishing through the values themselves (expensive) nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } encoder.encodeType(nValuesPerGenotype, encodingType); }
@Override @Requires({"encodingType != null", "nValuesPerGenotype >= 0 || ! getFieldEncoder().hasConstantNumElements()"}) @Ensures("nValuesPerGenotype >= 0") public void start(final BCF2Encoder encoder, final VariantContext vc) throws IOException { // writes the key information super.start(encoder, vc); // only update if we need to if ( ! getFieldEncoder().hasConstantNumElements() ) { if ( getFieldEncoder().hasContextDeterminedNumElements() ) // we are cheap -- just depends on genotype of allele counts nValuesPerGenotype = getFieldEncoder().numElements(vc); else // we have to go fishing through the values themselves (expensive) nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } encoder.encodeType(nValuesPerGenotype, encodingType); }