private static void sparseEdgeTest(final ISchemaVersion schemaVersion) throws IOException {
  final Writer output=openOutput(schemaVersion,"sparse_edge",TestType.ADD);
  final HLL hll=newHLL(HLLType.SPARSE);
  initLineAdd(output,hll,schemaVersion);
  final long firstValue=constructHLLValue(LOG2M,0,2);
  cumulativeAddLine(output,hll,firstValue,schemaVersion);
  final long lastValue=constructHLLValue(LOG2M,(1 << LOG2M) - 1,2);
  cumulativeAddLine(output,hll,lastValue,schemaVersion);
  for (int i=2; i < (SPARSE_THRESHOLD + 2); i++) {
    final long middleValue=constructHLLValue(LOG2M,i,1);
    cumulativeAddLine(output,hll,middleValue,schemaVersion);
  }
  output.flush();
  output.close();
}

private static void sparseEdgeTest ( final ISchemaVersion schemaVersion ) throws IOException { final Writer output = openOutput ( schemaVersion , "sparse_edge" , TestType . ADD ) ; final HLL hll = newHLL ( HLLType . SPARSE ) ; initLineAdd ( output , hll , schemaVersion ) ; final long firstValue = constructHLLValue ( LOG2M , 0 , 2 ) ; cumulativeAddLine ( output , hll , firstValue , schemaVersion ) ; final long lastValue = constructHLLValue ( LOG2M , ( 1 << LOG2M ) - 1 , 2 ) ; cumulativeAddLine ( output , hll , lastValue , schemaVersion ) ; for ( int i = 2 ; i < ( SPARSE_THRESHOLD + 2 ) ; i ++ ) { final long middleValue = constructHLLValue ( LOG2M , i , 1 ) ; cumulativeAddLine ( output , hll , middleValue , schemaVersion ) ; } output . flush ( ) ; output . close ( ) ; }
cumulatively sets the first register ( index 0 ) to value 2 , the last register ( index m - 1 ) to value 2 , and then sets registers with indices in the range 2 to ( sparsecutoff + 2 ) to value 1 to trigger promotion . this tests for register alignment in the promotion from sparse to full . format : cumulative add tests : - sparse addition - sparse to full promotion
