Examples of BitSet


Examples of java.util.BitSet

        testGetSet();
        testRandomSetRange();
    }

    private void testNextClearBit() {
        BitSet set = new BitSet();
        BitField field = new BitField();
        set.set(0, 640);
        field.set(0, 640, true);
        assertEquals(set.nextClearBit(0), field.nextClearBit(0));

        Random random = new Random(1);
        field = new BitField();
        field.set(0, 500, true);
        for (int i = 0; i < 100000; i++) {
View Full Code Here

Examples of java.util.BitSet

        }
    }

    private void testRandom() {
        BitField bits = new BitField();
        BitSet set = new BitSet();
        int max = 300;
        int count = 100000;
        Random random = new Random(1);
        for (int i = 0; i < count; i++) {
            int idx = random.nextInt(max);
            if (random.nextBoolean()) {
                if (random.nextBoolean()) {
                    bits.set(idx);
                    set.set(idx);
                } else {
                    bits.clear(idx);
                    set.clear(idx);
                }
            } else {
                assertEquals(set.get(idx), bits.get(idx));
                assertEquals(set.nextClearBit(idx), bits.nextClearBit(idx));
                assertEquals(set.length(), bits.length());
            }
        }
    }
View Full Code Here

Examples of java.util.BitSet

        }
    }

    private void testRandomSetRange() {
        BitField bits = new BitField();
        BitSet set = new BitSet();
        Random random = new Random(1);
        int maxOffset = 500;
        int maxLen = 500;
        int total = maxOffset + maxLen;
        int count = 10000;
        for (int i = 0; i < count; i++) {
            int offset = random.nextInt(maxOffset);
            int len = random.nextInt(maxLen);
            boolean val = random.nextBoolean();
            set.set(offset, offset + len, val);
            bits.set(offset, offset + len, val);
            for (int j = 0; j < total; j++) {
                assertEquals(set.get(j), bits.get(j));
            }
        }
    }
View Full Code Here

Examples of java.util.BitSet

                inputFile.readIntegerArray(nodeinfo[i], 0, 2);
            }

            if (Debug.debugging("vpfserver")) {
                int baseOffset = 24 + nodesInTree * 8;
                BitSet b = new BitSet(nodesInTree);
                int actprimcnt = 0;
                b.set(0);
                for (int i = 0; i < nodesInTree; i++) {
                    if ((baseOffset + nodeinfo[i][0]) != inputFile.getFilePointer()) {
                        throw new FormatException("SI Input appears to be out-of-sync");
                    }
                    StringBuffer pr = new StringBuffer("i=" + (i + 1));
                    pr.append(" offset=" + nodeinfo[i][0]);
                    pr.append(" count=" + nodeinfo[i][1]);
                    for (int j = 0; j < nodeinfo[i][1]; j++) {
                        actprimcnt++;
                        PrimitiveRecord prim = new PrimitiveRecord(inputFile);
                        pr.append("\n\t").append(prim.toString());
                    }
                    if (nodeinfo[i][1] != 0) {
                        if ((i < 15) || ((i + 1) == nodesInTree)) {
                            System.out.println(pr);
                        }
                        b.set(i + 1);
                        if (!b.get((i + 1) / 2)) {
                            throw new FormatException("condition failed");
                        }
                    }
                }
                if (actprimcnt == numberOfPrimitives) {
View Full Code Here

Examples of java.util.BitSet

  /**
   * Construct a new syntax object with all bits turned off.
   * This is equivalent to RE_SYNTAX_EMACS.
   */
  public RESyntax() {
    bits = new BitSet(BIT_TOTAL);
  }
View Full Code Here

Examples of java.util.BitSet

   
    mainSwitch.addChild(branchgroup);
    mainSwitch.addChild(axisGroup);
    mainSwitch.setCapability(Switch.ALLOW_SWITCH_READ);
    mainSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);
    BitSet bs = mainSwitch.getChildMask();
    bs.set(0,true);
    bs.set(1,true);
    mainSwitch.setChildMask(bs);
       
        rootGroup.addChild(mainSwitch);
       
        universe.addBranchGraph(rootGroup);
View Full Code Here

Examples of java.util.BitSet

        lightVector = null;
            attach();
      }
     
    }else if (action.equals("Hide axis")) {
      BitSet bs = mainSwitch.getChildMask();
      bs.set(1,false);
      mainSwitch.setChildMask(bs);
     
    }else if (action.equals("Show axis")) {
      BitSet bs = mainSwitch.getChildMask();
      bs.set(1,true);
      mainSwitch.setChildMask(bs);
     
    }else if (action.equals(NodeResourcesManager.getResources().getStringValue("SaveAs"))) {
      //   Select a Systema file
      Java3DPlugin3DFileFilter filter = new Java3DPlugin3DFileFilter();
View Full Code Here

Examples of java.util.BitSet

   
    mainSwitch.addChild(branchgroup);
    mainSwitch.addChild(axisGroup);
    mainSwitch.setCapability(Switch.ALLOW_SWITCH_READ);
    mainSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);
    BitSet bs = mainSwitch.getChildMask();
    bs.set(0,true);
    bs.set(1,true);
    mainSwitch.setChildMask(bs);
       
        rootGroup.addChild(mainSwitch);
       
        universe.addBranchGraph(rootGroup);
View Full Code Here

Examples of java.util.BitSet

    public SwitchNode(ActiveNode parent) {
        super(parent);
        anonymousNodeNumber++;
        name = NodeResourcesManager.getNodeName("Switch") + ((anonymousNodeNumber == 1) ? "" : String.valueOf(anonymousNodeNumber));
        status = new BitSet();
    }
View Full Code Here

Examples of java.util.BitSet

      return false;
    return true;
  }
 
  public static Int128 XOR(Int128 a, Int128 b) {
    BitSet xor_bit_set = (BitSet) a.getBitSet().clone();
    xor_bit_set.xor(b.getBitSet());
    return new Int128(xor_bit_set);
  }
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.