Package gnu.trove

Examples of gnu.trove.TIntHashSet


  private volatile ConcurrentSkipListSet<Integer> data;
  private volatile TIntHashSet cacher;
  private volatile int size = 0;

  public ConcurrentSetIntCacher() {
    cacher = new TIntHashSet();
    data = new ConcurrentSkipListSet<Integer>();
  }
View Full Code Here


  public void cacheWikipediaData(String wikipediaDataDirectory) {
    ProgressNotifier progress = new ProgressNotifier(5);
    File dataDirectory = new File(wikipediaDataDirectory);

    // cache tables that will be used extensively
    TIntHashSet validPageIds;
    try {
      validPageIds = wikipedia.getDatabase().getValidPageIds(
          dataDirectory, 2, progress);
      wikipedia.getDatabase().cachePages(dataDirectory, validPageIds,
          progress);
View Full Code Here

        "/Users/alyona/Data/wikipedia/data/20090306");
   
    if (cacheData) {
      ProgressNotifier progress = new ProgressNotifier(5);
      // cache tables that will be used extensively
      TIntHashSet validPageIds = wikipedia.getDatabase().getValidPageIds(
          dataDirectory, 2, progress);
      wikipedia.getDatabase().cachePages(dataDirectory, validPageIds,
          progress);
      wikipedia.getDatabase().cacheAnchors(dataDirectory, textProcessor,
          validPageIds, 2, progress);
View Full Code Here

  }

  public void addOccurence(int key, int value) {
    if (mySingle.containsKey(key)) {
      int old = mySingle.get(key);
      TIntHashSet items = new TIntHashSet(3);
      items.add(old);
      items.add(value);
      mySingle.remove(key);
      myMulti.put(key, items);
      return;
    }
    final TIntHashSet items = myMulti.get(key);
    if (items != null) {
      items.add(value);
      return;
    }
    mySingle.put(key, value);
  }
View Full Code Here

  public void removeOccurence(int key, int value) {
    if (mySingle.containsKey(key)) {
      mySingle.remove(key);
      return;
    }
    TIntHashSet items = myMulti.get(key);
    if (items != null) {
      items.remove(value);
      if (items.size() == 1) {
        mySingle.put(key, items.toArray()[0]);
        myMulti.remove(key);
      }
    }
  }
View Full Code Here

  public int[] get(int key) {
    if (mySingle.containsKey(key)) {
      return new int[]{mySingle.get(key)};
    }
    TIntHashSet items = myMulti.get(key);
    if (items == null) return ArrayUtil.EMPTY_INT_ARRAY;
    return items.toArray();
  }
View Full Code Here

public class TrigramBuilder {
  private TrigramBuilder() {
  }

  public static TIntHashSet buildTrigram(CharSequence text) {
    TIntHashSet caseInsensitive = new TIntHashSet();

    int tc1 = 0;
    int tc2 = 0;
    int tc3;

    for (int i = 0; i < text.length(); i++) {
      char c = StringUtil.toLowerCase(text.charAt(i));

      tc3 = (tc2 << 8) + c;
      tc2 = (tc1 << 8) + c;
      tc1 = c;

      if (i >= 2) {
        if (!blackList.contains(tc3)) {
          caseInsensitive.add(tc3);
        }
      }
    }

    return caseInsensitive;
View Full Code Here

    }

    stats.bytes += buf.length();

    long start = System.nanoTime();
    TIntHashSet localTrigrams = lexText(buf);
    stats.time += System.nanoTime() - start;
    stats.maxtrigrams = Math.max(stats.maxtrigrams, localTrigrams.size());
    int[] graphs = localTrigrams.toArray();
    stats.allTrigrams.addAll(graphs);
    for (int graph : graphs) {
      List<File> list = stats.filesMap.get(graph);
      if (list == null) {
        list = new ArrayList<File>();
View Full Code Here

    int totalX = 0;
    int totalY = 0;

    int key, x, y;

    TIntHashSet distinctKeys = new TIntHashSet();
    distinctKeys.addAll(countsX.keys());
    distinctKeys.addAll(countsY.keys());

    TIntIterator iterator = distinctKeys.iterator();
    while (iterator.hasNext()) {
      key = iterator.next();

      x = 0;
      if (countsX.containsKey(key)) {
View Full Code Here

    private CachedFilePage myFreePage;

    SingleFileCachingStrategy(int pageSize, int pagesCount) {
      myPageSize = pageSize;
      myCache = new IntObjectCache<CachedFilePage>(pagesCount);
      myDirtyPages = new TIntHashSet();
      myCache.addDeletedPairsListener(new IntObjectCache.DeletedPairsListener() {
        public void objectRemoved(final int key, final Object value) {
          myFreePage = (CachedFilePage)value;
        }
      });
View Full Code Here

TOP

Related Classes of gnu.trove.TIntHashSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.