protected List<? extends Itemset> frequentItemsets(List<? extends Itemset> candidates,Relation<BitVector> relation,int needed,DBIDs ids,ArrayModifiableDBIDs survivors,int length){
  if (candidates.isEmpty()) {
    return Collections.emptyList();
  }
  Itemset first=candidates.get(0);
  if (candidates.size() > length * length * length* 100 && first instanceof SparseItemset) {
    @SuppressWarnings("unchecked") List<SparseItemset> sparsecand=(List<SparseItemset>)candidates;
    return frequentItemsetsSparse(sparsecand,relation,needed,ids,survivors,length);
  }
  for (DBIDIter iditer=ids.iter(); iditer.valid(); iditer.advance()) {
    BitVector bv=relation.get(iditer);
    int lives=0;
    for (    Itemset candidate : candidates) {
      if (candidate.containedIn(bv)) {
        candidate.increaseSupport();
        ++lives;
      }
    }
    if (lives > length) {
      survivors.add(iditer);
    }
  }
  List<Itemset> frequent=new ArrayList<>(candidates.size());
  for (Iterator<? extends Itemset> iter=candidates.iterator(); iter.hasNext(); ) {
    final Itemset candidate=iter.next();
    if (candidate.getSupport() >= needed) {
      frequent.add(candidate);
    }
  }
  return frequent;
}

protected List < ? extends Itemset > frequentItemsets ( List < ? extends Itemset > candidates , Relation < BitVector > relation , int needed , DBIDs ids , ArrayModifiableDBIDs survivors , int length ) { if ( candidates . isEmpty ( ) ) { return Collections . emptyList ( ) ; } Itemset first = candidates . get ( 0 ) ; if ( candidates . size ( ) > length * length * length * 100 && first instanceof SparseItemset ) { @ SuppressWarnings ( "unchecked" ) List < SparseItemset > sparsecand = ( List < SparseItemset > ) candidates ; return frequentItemsetsSparse ( sparsecand , relation , needed , ids , survivors , length ) ; } for ( DBIDIter iditer = ids . iter ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { BitVector bv = relation . get ( iditer ) ; int lives = 0 ; for ( Itemset candidate : candidates ) { if ( candidate . containedIn ( bv ) ) { candidate . increaseSupport ( ) ; ++ lives ; } } if ( lives > length ) { survivors . add ( iditer ) ; } } List < Itemset > frequent = new ArrayList < > ( candidates . size ( ) ) ; for ( Iterator < ? extends Itemset > iter = candidates . iterator ( ) ; iter . hasNext ( ) ; ) { final Itemset candidate = iter . next ( ) ; if ( candidate . getSupport ( ) >= needed ) { frequent . add ( candidate ) ; } } return frequent ; }
returns the frequent bitsets out of the given bitsets with respect to the given database .
