Java Code Examples for org.apache.rocketmq.filter.util.BitsArray#getBit()

The following examples show how to use org.apache.rocketmq.filter.util.BitsArray#getBit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testAndOr() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    if (val) {
        bitsArray.and(2, false);
        assertThat(!bitsArray.getBit(2)).isTrue();
    } else {
        bitsArray.or(2, true);
        assertThat(bitsArray.getBit(2)).isTrue();
    }
}
 
Example 2
Source File: BitsArrayTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testAndOr() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    if (val) {
        bitsArray.and(2, false);
        assertThat(!bitsArray.getBit(2)).isTrue();
    } else {
        bitsArray.or(2, true);
        assertThat(bitsArray.getBit(2)).isTrue();
    }
}
 
Example 3
Source File: BitsArrayTest.java    From rocketmq-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testAndOr() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    if (val) {
        bitsArray.and(2, false);
        assertThat(!bitsArray.getBit(2)).isTrue();
    } else {
        bitsArray.or(2, true);
        assertThat(bitsArray.getBit(2)).isTrue();
    }
}
 
Example 4
Source File: BitsArrayTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testAndOr() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    if (val) {
        bitsArray.and(2, false);
        assertThat(!bitsArray.getBit(2)).isTrue();
    } else {
        bitsArray.or(2, true);
        assertThat(bitsArray.getBit(2)).isTrue();
    }
}
 
Example 5
Source File: BitsArrayTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 5 votes vote down vote up
@Test
public void testAndOr() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    if (val) {
        bitsArray.and(2, false);
        assertThat(!bitsArray.getBit(2)).isTrue();
    } else {
        bitsArray.or(2, true);
        assertThat(bitsArray.getBit(2)).isTrue();
    }
}
 
Example 6
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testAndOr() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    if (val) {
        bitsArray.and(2, false);
        assertThat(!bitsArray.getBit(2)).isTrue();
    } else {
        bitsArray.or(2, true);
        assertThat(bitsArray.getBit(2)).isTrue();
    }
}
 
Example 7
Source File: BitsArrayTest.java    From rocketmq with Apache License 2.0 3 votes vote down vote up
@Test
public void testXor() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    bitsArray.xor(2, !val);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 8
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 3 votes vote down vote up
@Test
public void testSet() {
    BitsArray bitsArray = gen(bitLength);
    BitsArray backUp = bitsArray.clone();

    boolean val = bitsArray.getBit(2);

    bitsArray.setBit(2, !val);

    bitsArray.xor(backUp);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 9
Source File: BitsArrayTest.java    From rocketmq with Apache License 2.0 3 votes vote down vote up
@Test
public void testSet() {
    BitsArray bitsArray = gen(bitLength);
    BitsArray backUp = bitsArray.clone();

    boolean val = bitsArray.getBit(2);

    bitsArray.setBit(2, !val);

    bitsArray.xor(backUp);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 10
Source File: BitsArrayTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 3 votes vote down vote up
@Test
public void testXor() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    bitsArray.xor(2, !val);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 11
Source File: BitsArrayTest.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 3 votes vote down vote up
@Test
public void testSet() {
    BitsArray bitsArray = gen(bitLength);
    BitsArray backUp = bitsArray.clone();

    boolean val = bitsArray.getBit(2);

    bitsArray.setBit(2, !val);

    bitsArray.xor(backUp);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 12
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 3 votes vote down vote up
@Test
public void testXor() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    bitsArray.xor(2, !val);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 13
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 3 votes vote down vote up
@Test
public void testSet() {
    BitsArray bitsArray = gen(bitLength);
    BitsArray backUp = bitsArray.clone();

    boolean val = bitsArray.getBit(2);

    bitsArray.setBit(2, !val);

    bitsArray.xor(backUp);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 14
Source File: BitsArrayTest.java    From rocketmq-read with Apache License 2.0 3 votes vote down vote up
@Test
public void testXor() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    bitsArray.xor(2, !val);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 15
Source File: BitsArrayTest.java    From rocketmq-read with Apache License 2.0 3 votes vote down vote up
@Test
public void testSet() {
    BitsArray bitsArray = gen(bitLength);
    BitsArray backUp = bitsArray.clone();

    boolean val = bitsArray.getBit(2);

    bitsArray.setBit(2, !val);

    bitsArray.xor(backUp);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 16
Source File: BitsArrayTest.java    From rocketmq-4.3.0 with Apache License 2.0 3 votes vote down vote up
@Test
public void testXor() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    bitsArray.xor(2, !val);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 17
Source File: BitsArrayTest.java    From rocketmq-4.3.0 with Apache License 2.0 3 votes vote down vote up
@Test
public void testSet() {
    BitsArray bitsArray = gen(bitLength);
    BitsArray backUp = bitsArray.clone();

    boolean val = bitsArray.getBit(2);

    bitsArray.setBit(2, !val);

    bitsArray.xor(backUp);

    assertThat(bitsArray.getBit(2)).isTrue();
}
 
Example 18
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 3 votes vote down vote up
@Test
public void testXor() {
    BitsArray bitsArray = gen(bitLength);

    boolean val = bitsArray.getBit(2);

    bitsArray.xor(2, !val);

    assertThat(bitsArray.getBit(2)).isTrue();
}