Package cleo.search.util

Examples of cleo.search.util.Range


    super(name, elementStore, selectorFactory, bloomFilter);
    logger.info(name + " start...");
   
    this.rangeStart = elementStore.getIndexStart();
    this.rangeEnd = elementStore.getIndexStart() + elementStore.length();
    this.range = new Range(rangeStart, rangeEnd - rangeStart);
    this.filterData = initFilterData();
   
    logger.info(name + " started.");
  }
View Full Code Here


            baseTypeahead.getSelectorFactory(),
            baseTypeahead.getBloomFilter());
      this.baseTypeahead = baseTypeahead;
      this.rangeStart = rangeStart;
      this.rangeEnd = rangeEnd;
      this.range = new Range(rangeStart, rangeEnd - rangeStart);
    }
View Full Code Here

   
    // Initialize bloom filter store
    this.filterStore = initFilterStore();
   
    // Initialize the element id range
    this.range = new Range(elementStore.getIndexStart(), elementStore.capacity());
   
    // Initialize the resource pool for byte array
    this.bytesPool = new ResourcePool<byte[]>(bytesPoolSize);
   
    // List properties
View Full Code Here

    config.setName(properties.getProperty("cleo.search.network.typeahead.config.name"));
   
    // connectionFilter for network partition
    config.setPartitionStart(Integer.parseInt(properties.getProperty("cleo.search.network.typeahead.config.partition.start")));
    config.setPartitionCount(Integer.parseInt(properties.getProperty("cleo.search.network.typeahead.config.partition.count")));
    Range partitionRange = new Range(config.getPartitionStart(), config.getPartitionCount());
   
    ConnectionFilter connectionFilter = (ConnectionFilter)
      Class.forName(properties.getProperty("cleo.search.network.typeahead.config.connectionFilter.class")).getConstructor(Range.class).newInstance(partitionRange);
    config.setConnectionFilter(connectionFilter);
   
View Full Code Here

   
    // Initialize the connection strength/weight adjuster
    this.weightAdjuster = weightAdjuster == null ? new ConnectionStrengthAdjuster() : weightAdjuster;
   
    // Initialize the element id range
    this.range = new Range(elementStore.getIndexStart(), elementStore.capacity());
   
    // Initialize the resource pool for byte array
    this.bytesPool = new ResourcePool<byte[]>(bytesPoolSize);
   
    // List properties
View Full Code Here

  protected SelectorFactory<E> createSelectorFactory() {
    return new ScoredElementSelectorFactory<E>();
  }
 
  protected ConnectionFilter createConnectionFilter() {
    return new TransitivePartitionConnectionFilter(new Range(getPartitionStart(), getPartitionCount()));
  }
View Full Code Here

    BloomFilter<Integer> bloomFilter = new FnvBloomFilter(config.getFilterPrefixLength());
   
    // create connectionFilter
    ConnectionFilter connectionFilter = config.getConnectionFilter();
    if(connectionFilter == null) {
      connectionFilter = new TransitivePartitionConnectionFilter(new Range(config.getPartitionStart(), config.getPartitionCount()));
    }
   
    // create NetworkTypeahead
    return new VanillaNetworkTypeahead<E>(config.getName(), elementStore, connectionsStore, selectorFactory, bloomFilter, connectionFilter);
  }
View Full Code Here

    if(selectorFactory == null) selectorFactory = new PrefixSelectorFactory<E>();
   
    // create connectionFilter
    ConnectionFilter connectionFilter = config.getConnectionFilter();
    if(connectionFilter == null) {
      connectionFilter = new TransitivePartitionConnectionFilter(new Range(config.getPartitionStart(), config.getPartitionCount()));
    }
   
    // create WeightedNetworkTypeahead
    return new WeightedNetworkTypeahead<E>(config.getName(), elementStore, weightedConnectionsStore, selectorFactory, bloomFilter, connectionFilter);
  }
View Full Code Here

  protected SelectorFactory<E> createSelectorFactory() {
    return new ScoredPrefixSelectorFactory<E>();
  }
 
  protected ConnectionFilter createConnectionFilter() {
    return new TransitivePartitionConnectionFilter(new Range(getPartitionStart(), getPartitionCount()));
  }
View Full Code Here

  private final Random rand = new Random();
 
  public void testSourcePartitionConnectionFilter() {
    int start = rand.nextInt(10000) + 100;
    int count = rand.nextInt(10000) + 100;
    Range sourceRange = new Range(start, count);
    ConnectionFilter connFilter = new SourcePartitionConnectionFilter(sourceRange);
   
    Connection conn = new SimpleConnection(0, rand.nextInt(), true);
    assertEquals(false, connFilter.accept(conn));
   
    conn = new SimpleConnection(rand.nextInt(start), rand.nextInt(), true);
    assertEquals(false, connFilter.accept(conn));
   
    conn = new SimpleConnection(start + rand.nextInt(count), rand.nextInt(), true);
    assertEquals(true, connFilter.accept(conn));
   
    conn = new SimpleConnection(sourceRange.getEnd(), rand.nextInt(), true);
    assertEquals(false, connFilter.accept(conn));
   
    conn = new SimpleConnection(sourceRange.getEnd() + rand.nextInt(count), rand.nextInt(), true);
    assertEquals(false, connFilter.accept(conn));
  }
View Full Code Here

TOP

Related Classes of cleo.search.util.Range

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.