Ejemplo n.º 1
0
 /**
  * Create a ResizableArray with the specified initialCapacity, expansionFactor, and
  * contractionCriteria. The <code>expansionMode</code> will default to <code>MULTIPLICATIVE_MODE.
  * </code>
  *
  * <p>Throws IllegalArgumentException if the following conditions are not met:
  *
  * <ul>
  *   <li><code>initialCapacity > 0</code>
  *   <li><code>expansionFactor > 1</code>
  *   <li><code>contractionFactor >= expansionFactor</code>
  * </ul>
  *
  * @param initialCapacity The initial size of the internal storage array
  * @param expansionFactor the array will be expanded based on this parameter
  * @param contractionCriteria The contraction Criteria.
  * @throws IllegalArgumentException if parameters are not valid
  */
 public ResizableDoubleArray(
     int initialCapacity, float expansionFactor, float contractionCriteria) {
   this.expansionFactor = expansionFactor;
   setContractionCriteria(contractionCriteria);
   setInitialCapacity(initialCapacity);
   internalArray = new double[initialCapacity];
 }
Ejemplo n.º 2
0
 /**
  * Create a ResizableArray with the specified initial capacity. Other properties take default
  * values:
  *
  * <ul>
  *   <li><code>expansionMode = MULTIPLICATIVE_MODE</code>
  *   <li><code>expansionFactor = 2.5</code>
  *   <li><code>contractionFactor = 2.0</code>
  * </ul>
  *
  * @param initialCapacity The initial size of the internal storage array
  * @throws IllegalArgumentException if initialCapacity is not > 0
  */
 public ResizableDoubleArray(int initialCapacity) {
   setInitialCapacity(initialCapacity);
   internalArray = new double[this.initialCapacity];
 }