Package it.unimi.dsi.fastutil.ints

Examples of it.unimi.dsi.fastutil.ints.IntSet


      _numIter = numIter;
      _collector = statsCollector;

      int maxDoc = reader.maxDoc();

      IntSet idSet = new IntOpenHashSet();
      while (idSet.size() < numToFetch) {
        int docid = _rand.nextInt(maxDoc);
        if (!idSet.contains(docid) && !reader.isDeleted(docid)) {
          idSet.add(docid);
        }
      }

      docsToFetch = idSet.toIntArray();
    }
View Full Code Here


       
      }
    }
   
    public int[] convert(FacetDataCache dataCache, String[] vals) {
      IntSet intSet = new IntOpenHashSet();
        getFilters(dataCache,intSet,vals, _depth, _strict);
        return intSet.toIntArray();
    }
View Full Code Here

    for (int i=0;i<docs.length;++i)
    {
      docs[i]=i;
    }
    int limit = 10000;
    IntSet set1 = new IntRBTreeSet();
    while(set1.size() < limit)
    {
      set1.add(rand.nextInt(max));
    }
   
    IntSet set2 = new IntOpenHashSet();
    for (int i : set1)
    {
      set2.add(i);
    }
   
    int[] set3 = set1.toIntArray();
    Arrays.sort(set3);
   
    BitSet set4 = new BitSet();
    for (int i : set1)
    {
      set4.set(i);
    }
   
    long start,end;
   
    start=System.nanoTime();
    for (int i=0;i<docs.length;++i)
    {
      set1.contains(i);
    }
    end=System.nanoTime();
    System.out.println("set1: "+(end-start)/1000000);
   
    start=System.nanoTime();
    for (int i=0;i<docs.length;++i)
    {
      set2.contains(i);
    }
    end=System.nanoTime();
    System.out.println("set2: "+(end-start)/1000000);
   
    start=System.nanoTime();
View Full Code Here

       
      }
    }
   
    public int[] convert(FacetDataCache dataCache, String[] vals) {
      IntSet intSet = new IntOpenHashSet();
        getFilters(dataCache,intSet,vals, _depth, _strict);
        return intSet.toIntArray();
    }
View Full Code Here

   */
  public void test15() {
    for (int i = 0; i < 20; i++) {
      Model model = getModelFromResource("test15.rdf");
      ReferenceGroundedDecomposition refDec = getDecomposition(model);
      IntSet sizes = new IntOpenHashSet();
      for (FunctionallyGroundedNode fgNode : refDec
          .getFunctionallyGroundedNodes()) {
        sizes.add(fgNode.getGroundingMolecules().size());
      }
      System.out.println(sizes);
      IntSet expectedSizes = new IntOpenHashSet();
      expectedSizes.add(1); // for two nodes
      expectedSizes.add(3); // for the node with the 2 mboxes
      assertEquals(expectedSizes, sizes);
      // System.out.println(refDec.getFunctionallyGroundedNodes());
    }
  }
View Full Code Here

  private static boolean getPossibleMappingClasses(ContextGraph g1,
      ContextGraph g2, IntHashMap<Collection[]> targetMap) throws NoMappingException {

    boolean result = true;
    IntHashMap<Collection<ContextNode>> map1 = getHashClasses(g1, null);
    IntSet keySet = map1.keySet();
    IntHashMap<Collection<ContextNode>> map2 = getHashClasses(g2, keySet);
    if (map2 == null) {
      throw new NoMappingException();
    }
    for (IntIterator iter = keySet.intIterator(); iter.hasNext();) {
      int currentHash = iter.nextInt();
      Collection[] mappingClasses = new Collection[2];
      mappingClasses[0] = (Collection) map1.get(currentHash);
      mappingClasses[1] = (Collection) map2.get(currentHash);
      if (mappingClasses[1] == null) {
View Full Code Here

        .hasNext();) {
      int currentHash = iter.nextInt();
      Collection[] mappingClasses = (Collection[]) classesMap
          .get(currentHash);
      IntHashMap<Collection<ContextNode>> newClasses1 = getHashClasses(mappingClasses[0], null);
      IntSet keySet1 = newClasses1.keySet();
      IntHashMap<Collection<ContextNode>> newClasses2 = getHashClasses(mappingClasses[1], keySet1);
      int size1 = keySet1.size();
      if ((newClasses2 == null) || (size1 != newClasses2.size())) {
        g1.resetNodeHashes();
        g2.resetNodeHashes();
        throw new NoMappingException();
      }
      if (size1 > 1) {
        newClassesDifferent = true;
      }

      for (IntIterator iter2 = keySet1.intIterator(); iter2.hasNext();) {
        int currentNewHash = iter2.nextInt();
        Collection[] newMappingClasses = new Collection[2];
        newMappingClasses[0] = (Collection) newClasses1
            .get(currentNewHash);
        newMappingClasses[1] = (Collection) newClasses2
View Full Code Here

    }

    static final Pattern PARTITION_PATTERN = Pattern.compile("[\\d]+||[\\d]+-[\\d]+");

    public static int[] buildPartitions(String[] partitionArray) throws ConfigurationException {
        IntSet partitions = new IntOpenHashSet();
        try {
            for (int i = 0; i < partitionArray.length; ++i) {
                Matcher matcher = PARTITION_PATTERN.matcher(partitionArray[i]);
                if (!matcher.matches()) {
                    throw new ConfigurationException("Invalid partition: " + partitionArray[i]);
                }
                String[] partitionRange = partitionArray[i].split("-");
                int start = Integer.parseInt(partitionRange[0]);
                int end;
                if (partitionRange.length > 1) {
                    end = Integer.parseInt(partitionRange[1]);
                    if (end < start) {
                        throw new ConfigurationException("invalid partition range: " + partitionArray[i]);
                    }
                } else {
                    end = start;
                }

                for (int k = start; k <= end; ++k) {
                    partitions.add(k);
                }
            }
        } catch (Exception e) {
            throw new ConfigurationException(
                    "Error parsing '" + SENSEI_PROPERTIES + "': " + PARTITIONS + "=" + Arrays.toString(partitionArray), e);
        }

        int[] ret = partitions.toIntArray();
        Arrays.sort(ret);
        return ret;
    }
View Full Code Here

    return (T) request;
  }

  protected IntSet getPartitions(Set<Node> nodes)
  {
      IntSet partitionSet = new IntOpenHashSet();
      for (Node n : nodes)
      {
        partitionSet.addAll(n.getPartitionIds());
      }
      return partitionSet;
    }
View Full Code Here

      }
      Set<RequirementBasedColumnKey> missingColumnKeys = analysisResult.getUnsatisfiedRequirements(target);
      if (missingColumnKeys == null) {
        continue;
      }
      IntSet missingColumnIds = new IntArraySet();
      for (RequirementBasedColumnKey requirementBasedKey : missingColumnKeys) {
        WebViewGridColumn missingGridColumn = requirementBasedColumns.get(requirementBasedKey);
        if (missingGridColumn == null) {
          continue;
        }
        missingColumnIds.add(missingGridColumn.getId());
      }
      _unsatisfiedCells.put(targetRowId, missingColumnIds);
    }
    _targets = new ComputationTargetSpecification[nextId];
    for (ComputationTargetSpecification target : targets) {
View Full Code Here

TOP

Related Classes of it.unimi.dsi.fastutil.ints.IntSet

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.