@Override public void seal() { sealed = true; sortedIntList = new int[rawIntSet.size()]; rawIntSet.toArray(sortedIntList); Arrays.sort(sortedIntList); if (sortedIntList.length == 0) { min = null; max = null; return; } // Update min/max based on raw docs. min = sortedIntList[0]; max = sortedIntList[sortedIntList.length - 1]; // Merge the raw and aggregated docs, so stats for dictionary creation are collected correctly. int numAggregated = aggregatedIntSet.size(); if (numAggregated > 0) { rawIntSet.addAll(aggregatedIntSet); sortedIntList = new int[rawIntSet.size()]; rawIntSet.toArray(sortedIntList); Arrays.sort(sortedIntList); } } }
public Object[] toArray() { return _set.toArray(); }
public <T> T[] toArray(T[] a) { return _set.toArray(a); }
public int[] toArray(int[] a) { return _set.toArray(a); }
public int[] toArray(int[] a) { return _set.toArray(a); }
public int[] toArray(int[] a) { return _set.toArray(a); }
public Object[] toArray() { return _set.toArray(); }
public Object[] toArray() { return _set.toArray(); }
public <T> T[] toArray(T[] a) { return _set.toArray(a); }
public <T> T[] toArray(T[] a) { return _set.toArray(a); }
/** Selects a subset of size at most <code>card</code> from <code>s</code>. * * @param s the set from which the subset should be extracted. * @param card the maximum cardinality allowed for the extracted set. * @return a subset of s selected at random. */ private IntSet select( final IntSet s, final int card ) { if ( card == 0 ) return IntSets.EMPTY_SET; else if ( card >= s.size() ) return s; else { int n = s.size(); final int[] node = new int[ n ]; s.toArray( node ); IntArrays.quickSort( node, new AbstractIntComparator() { private static final long serialVersionUID = 1L; @Override public int compare( int x, int y ) { return nodePermutation[ x ] - nodePermutation[ y ]; } }); IntSet result = new IntOpenHashSet(); for ( int i = 0; i < card; i++ ) result.add( node[ i ] ); return result; } }