/** {@inheritDoc} */ public TDoubleList inverseGrep( TDoubleProcedure condition ) { TDoubleArrayList list = new TDoubleArrayList(); for ( int i = 0; i < _pos; i++ ) { if ( !condition.execute( _data[ i ] ) ) { list.add( _data[ i ] ); } } return list; }
@Override public void extendVariantArraySize(int initVariantArraySize, int number, int sourceIndex) { super.extendVariantArraySize(initVariantArraySize, number, sourceIndex); regulationValue.ensureCapacity(regulationValue.size() + number); for (int i = 0; i < number; i++) { regulationValue.add(regulationValue.get(sourceIndex)); } }
/** * Pushes the value onto the top of the stack. * * @param val an <code>double</code> value */ public void push( double val ) { _list.add( val ); }
private double[] excludeZeros(double[] sampledScores){ TDoubleArrayList withoutZero = new TDoubleArrayList(); for (double sampledScore : sampledScores){ if (sampledScore>0) withoutZero.add(sampledScore); } return withoutZero.toArray(); }
/** * Creates a new <code>TDoubleArrayStack</code> instance with the * specified capacity. * * @param capacity the initial depth of the stack * @param no_entry_value value that represents null */ public TDoubleArrayStack( int capacity, double no_entry_value ) { _list = new TDoubleArrayList( capacity, no_entry_value ); }
/** * Returns the current depth of the stack. */ public int size() { return _list.size(); }
/** {@inheritDoc} */ public double[] toArray( double[] dest ) { int len = dest.length; if ( dest.length > _pos ) { len = _pos; dest[len] = no_entry_value; } toArray( dest, 0, len ); return dest; }
/** {@inheritDoc} */ public void insert( int offset, double value ) { if ( offset == _pos ) { add( value ); return; } ensureCapacity( _pos + 1 ); // shift right System.arraycopy( _data, offset, _data, offset + 1, _pos - offset ); // insert _data[ offset ] = value; _pos++; }
/** {@inheritDoc} */ public void set( int offset, double[] values ) { set( offset, values, 0, values.length ); }