Package java.util

Examples of java.util.BitSet


  public synchronized void sync()
    throws IOException
  {
    if (needsSync) {
      // Trim bit set
      BitSet bitSet = allocatedNodes;
      int bitSetLength = allocatedNodes.length();
      if (bitSetLength < allocatedNodes.size()) {
        bitSet = allocatedNodes.get(0, bitSetLength);
      }
View Full Code Here


    if (allocatedNodes != null) {
      allocatedNodes.clear();
    }
    else {
      // bit set has not yet been initialized
      allocatedNodes = new BitSet();
    }

    scheduleSync();
  }
View Full Code Here

  }

  private void crawlAllocatedNodes()
    throws IOException
  {
    allocatedNodes = new BitSet();

    BTree.Node rootNode = btree.readRootNode();
    if (rootNode != null) {
      crawlAllocatedNodes(rootNode);
    }
View Full Code Here

      {
        return doc%5 == 0;
      }
    };
   
    BitSet bs = new BitSet();
    for (int i=0;i<100;++i)
    {
      int n = 10*i;
      if (n < 200)
      {
        bs.set(n);
      }
    }
   
    try
    {
      int doc;
      while((doc=filteredIter.nextDoc())!=DocIdSetIterator.NO_MORE_DOCS)
      {
        if (!bs.get(doc)){
          fail("failed: "+doc+" not in expected set");
          return;
        }
        else
        {
          bs.clear(doc);
        }
      }
      if (bs.cardinality()>0)
      {
        fail("failed: leftover cardinatity: "+bs.cardinality());
      }
    }
    catch(Exception e)
    {
      fail(e.getMessage());
View Full Code Here

        nodeToFlowSet = new HashMap<N, BitSet>();
        nodeToIndex = new HashMap<N, Integer>();
        indexToNode = new HashMap<Integer,N>();
   
        //build full set
        fullSet = new BitSet(graph.size());
        fullSet.flip(0, graph.size());//set all to true
       
        //set up domain for intersection: head nodes are only dominated by themselves,
        //other nodes are dominated by everything else
        for(Iterator<N> i = graph.iterator(); i.hasNext();){
            N o = i.next();
            if(heads.contains(o)){
                BitSet self = new BitSet();
                self.set(indexOf(o));
                nodeToFlowSet.put(o, self);
            }
            else{
                nodeToFlowSet.put(o, fullSet);
            }
        }
   
        boolean changed = true;
        do{
            changed = false;
            for(Iterator<N> i = graph.iterator(); i.hasNext();){
                N o = i.next();
                if(heads.contains(o)) continue;
   
                //initialize to the "neutral element" for the intersection
                //this clone() is fast on BitSets (opposed to on HashSets)
        BitSet predsIntersect = (BitSet) fullSet.clone();
   
                //intersect over all predecessors
                for(Iterator<N> j = graph.getPredsOf(o).iterator(); j.hasNext();){
                    BitSet predSet = nodeToFlowSet.get(j.next());
                    predsIntersect.and(predSet);
                }
   
                BitSet oldSet = nodeToFlowSet.get(o);
                //each node dominates itself
                predsIntersect.set(indexOf(o));
                if(!predsIntersect.equals(oldSet)){
                    nodeToFlowSet.put(o, predsIntersect);
                    changed = true;
View Full Code Here

   
    public List<N> getDominators(Object node)
    {
        //reconstruct list of dominators from bitset
        List<N> result = new ArrayList<N>();
        BitSet bitSet = nodeToFlowSet.get(node);
        for(int i=0;i<bitSet.length();i++) {
            if(bitSet.get(i)) {
                result.add(indexToNode.get(i));
            }
        }
        return result;
    }
View Full Code Here

   */
  private final void findGotos(ByteSequence bytes, Method method, Code code)
       throws IOException
  {
    int index;
    goto_set = new BitSet(bytes.available());
    int opcode;

    /* First get Code attribute from method and the exceptions handled
     * (try .. catch) in this method. We only need the line number here.
     */
 
View Full Code Here

    // Reset multi selected rows
    // Best would be to remove the unnecessary bits, but how can we know if
    // a row has been added or deleted? Most save action is to clear the selections
    // and start fresh. But we will loose the selections this way.
    // Any better ideas?
    multiSelectSelectedRows = new BitSet();
  }
View Full Code Here

   *
   */
  private void updateMultiSelectState(UserRequest ureq) {
    String[] sRowIds = ureq.getHttpReq().getParameterValues(TableRenderer.TABLE_MULTISELECT_GROUP);
    if (sRowIds == null) {
      multiSelectSelectedRows = new BitSet(); //if all deselected create new multiSelectSelectedRows
      return;
    }
    List rowIds = new ArrayList();
    for (int i = 0; i < sRowIds.length; i++) {
      String sRowId = sRowIds[i];
View Full Code Here

      startRowId = 0;
      endRowId = rows;
      usePageing = false;
    }
       
    BitSet multiSelectSelectedRows = table.getMultiSelectSelectedRows();
    int lastVisibleRowId = endRowId-1;
    for (int i = startRowId; i < endRowId; i++) {
      // the position of the selected row in the tabledatamodel
      int currentPosInModel = table.getSortedRow(i);
      boolean isMark = selRowUnSelectable && (selRowId == currentPosInModel);
View Full Code Here

TOP

Related Classes of java.util.BitSet

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.