Save This Page
Home » mahout-collections-1.0-src » org.apache.mahout.math.set » [javadoc | source]
org.apache.mahout.math.set
abstract public class: AbstractSet [javadoc | source]
java.lang.Object
   org.apache.mahout.math.PersistentObject
      org.apache.mahout.math.set.AbstractSet

All Implemented Interfaces:
    Cloneable, Serializable

Direct Known Subclasses:
    OpenHashSet, OpenHashMap

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Field Summary
protected  int distinct    The number of distinct associations in the map; its "size()". 
protected  int lowWaterMark    The table capacity c=table.length always satisfies the invariant c * minLoadFactor <= s <= c * maxLoadFactor, where s=size() is the number of associations currently contained. The term "c * minLoadFactor" is called the "lowWaterMark", "c * maxLoadFactor" is called the "highWaterMark". In other words, the table capacity (and proportionally the memory used by this class) oscillates within these constraints. The terms are precomputed and cached to avoid recalculating them each time put(..) or removeKey(...) is called. 
protected  int highWaterMark     
protected  double minLoadFactor    The minimum load factor for the hashtable. 
protected  double maxLoadFactor    The maximum load factor for the hashtable. 
public static final  int defaultCapacity     
public static final  double defaultMinLoadFactor     
public static final  double defaultMaxLoadFactor     
Method from org.apache.mahout.math.set.AbstractSet Summary:
chooseGrowCapacity,   chooseHighWaterMark,   chooseLowWaterMark,   chooseMeanCapacity,   chooseShrinkCapacity,   clear,   ensureCapacity,   equalsMindTheNull,   isEmpty,   nextPrime,   setUp,   size,   trimToSize
Methods from org.apache.mahout.math.PersistentObject:
clone
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.mahout.math.set.AbstractSet Detail:
 protected int chooseGrowCapacity(int size,
    double minLoad,
    double maxLoad) 
    Chooses a new prime table capacity optimized for growing that (approximately) satisfies the invariant c * minLoadFactor <= size <= c * maxLoadFactor and has at least one FREE slot for the given size.
 protected int chooseHighWaterMark(int capacity,
    double maxLoad) 
    Returns new high water mark threshold based on current capacity and maxLoadFactor.
 protected int chooseLowWaterMark(int capacity,
    double minLoad) 
    Returns new low water mark threshold based on current capacity and minLoadFactor.
 protected int chooseMeanCapacity(int size,
    double minLoad,
    double maxLoad) 
    Chooses a new prime table capacity neither favoring shrinking nor growing, that (approximately) satisfies the invariant c * minLoadFactor <= size <= c * maxLoadFactor and has at least one FREE slot for the given size.
 protected int chooseShrinkCapacity(int size,
    double minLoad,
    double maxLoad) 
    Chooses a new prime table capacity optimized for shrinking that (approximately) satisfies the invariant c * minLoadFactor <= size <= c * maxLoadFactor and has at least one FREE slot for the given size.
 abstract public  void clear()
    Removes all (key,value) associations from the receiver.
 public  void ensureCapacity(int minCapacity) 
    Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory. If necessary, allocates new internal memory and increases the capacity of the receiver.

    This method never need be called; it is for performance tuning only. Calling this method before put()ing a large number of associations boosts performance, because the receiver will grow only once instead of potentially many times.

    This default implementation does nothing. Override this method if necessary.

 protected static boolean equalsMindTheNull(Object a,
    Object b) 
 public boolean isEmpty() 
    Returns true if the receiver contains no (key,value) associations.
 protected int nextPrime(int desiredCapacity) 
    Returns a prime number which is >= desiredCapacity and very close to desiredCapacity (within 11% if desiredCapacity >= 1000).
 protected  void setUp(int initialCapacity,
    double minLoadFactor,
    double maxLoadFactor) 
    Initializes the receiver. You will almost certainly need to override this method in subclasses to initialize the hash table.
 public int size() 
    Returns the number of (key,value) associations currently contained.
 public  void trimToSize() 
    Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous internal memory. An application can use this operation to minimize the storage of the receiver.

    This default implementation does nothing. Override this method if necessary.