@Override public Instance mergeInstance(Instance inst){
  int[] indices=new int[numValues() + inst.numValues()];
  int m=0;
  for (int j=0; j < numValues(); j++) {
    indices[m++]=index(j);
  }
  for (int j=0; j < inst.numValues(); j++) {
    if (inst.valueSparse(j) != 0) {
      indices[m++]=numAttributes() + inst.index(j);
    }
  }
  if (m != indices.length) {
    int[] newInd=new int[m];
    System.arraycopy(indices,0,newInd,0,m);
    indices=newInd;
  }
  return new BinarySparseInstance(1.0,indices,numAttributes() + inst.numAttributes());
}

@ Override public Instance mergeInstance ( Instance inst ) { int [ ] indices = new int [ numValues ( ) + inst . numValues ( ) ] ; int m = 0 ; for ( int j = 0 ; j < numValues ( ) ; j ++ ) { indices [ m ++ ] = index ( j ) ; } for ( int j = 0 ; j < inst . numValues ( ) ; j ++ ) { if ( inst . valueSparse ( j ) != 0 ) { indices [ m ++ ] = numAttributes ( ) + inst . index ( j ) ; } } if ( m != indices . length ) { int [ ] newInd = new int [ m ] ; System . arraycopy ( indices , 0 , newInd , 0 , m ) ; indices = newInd ; } return new BinarySparseInstance ( 1.0 , indices , numAttributes ( ) + inst . numAttributes ( ) ) ; }
merges this instance with the given instance and returns the result . dataset is set to null .
