Examples of BitSet


Examples of java.util.BitSet

        }

        @Override
        public void setPropertyValue(Integer res) {
            boolean forced=forceCapability(Switch.ALLOW_SWITCH_WRITE);
            BitSet b=new BitSet();
            SwitchAnimator.intToBitSet(res.intValue(),b);
            _object.setChildMask(b);
            if(forced) restoreCapability(Switch.ALLOW_SWITCH_WRITE);
        }
View Full Code Here

Examples of java.util.BitSet

  private BitSet bit_set;
 
  private int mark = -1;
 
  public Int128() {
    bit_set = new BitSet(128);
   
  }
View Full Code Here

Examples of java.util.BitSet

 
  /**
   * Create Int128 from stored value
   */
  public Int128(byte[] byteArray) {
    bit_set = new BitSet(128);
   
    ByteBuffer reversed = Misc.getByteBuffer(16);
   
    ByteBuffer tmp = Misc.getByteBuffer(4);

View Full Code Here

Examples of java.util.BitSet

                        if(s.getWhichChild()!=params[0]){
                            s.setWhichChild(params[0]);
                        }
                        break;
                    case MASK:
                        BitSet b=new BitSet();
                        intToBitSet(params[0],b);
                        if(!b.equals(s.getChildMask())){
                            ((Switch)o.getObject()).setChildMask(b);
                        }
                        break;
                    }
                }
View Full Code Here

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

Examples of java.util.BitSet

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

    scheduleSync();
  }
View Full Code Here

Examples of java.util.BitSet

  }

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

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

Examples of java.util.BitSet

      {
        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

Examples of java.util.BitSet

        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

Examples of java.util.BitSet

   
    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
TOP
Copyright © 2018 www.massapi.com. 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.