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

The following examples show how to use org.apache.rocketmq.filter.util.BitsArray#or() . 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 DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testOr() {
    BitsArray b1 = BitsArray.create(new byte[] {(byte) 0xff, 0x00});
    BitsArray b2 = BitsArray.create(new byte[] {0x00, (byte) 0xff});

    b1.or(b2);

    for (int i = 0; i < b1.bitLength(); i++) {
        assertThat(b1.getBit(i)).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-4.3.0 with Apache License 2.0 5 votes vote down vote up
@Test
public void testOr() {
    BitsArray b1 = BitsArray.create(new byte[] {(byte) 0xff, 0x00});
    BitsArray b2 = BitsArray.create(new byte[] {0x00, (byte) 0xff});

    b1.or(b2);

    for (int i = 0; i < b1.bitLength(); i++) {
        assertThat(b1.getBit(i)).isTrue();
    }
}
 
Example 5
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 6
Source File: BitsArrayTest.java    From rocketmq-read with Apache License 2.0 5 votes vote down vote up
@Test
public void testOr() {
    BitsArray b1 = BitsArray.create(new byte[] {(byte) 0xff, 0x00});
    BitsArray b2 = BitsArray.create(new byte[] {0x00, (byte) 0xff});

    b1.or(b2);

    for (int i = 0; i < b1.bitLength(); i++) {
        assertThat(b1.getBit(i)).isTrue();
    }
}
 
Example 7
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 8
Source File: BitsArrayTest.java    From DDMQ with Apache License 2.0 5 votes vote down vote up
@Test
public void testOr() {
    BitsArray b1 = BitsArray.create(new byte[] {(byte) 0xff, 0x00});
    BitsArray b2 = BitsArray.create(new byte[] {0x00, (byte) 0xff});

    b1.or(b2);

    for (int i = 0; i < b1.bitLength(); i++) {
        assertThat(b1.getBit(i)).isTrue();
    }
}
 
Example 9
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 10
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 testOr() {
    BitsArray b1 = BitsArray.create(new byte[]{(byte) 0xff, 0x00});
    BitsArray b2 = BitsArray.create(new byte[]{0x00, (byte) 0xff});

    b1.or(b2);

    for (int i = 0; i < b1.bitLength(); i++) {
        assertThat(b1.getBit(i)).isTrue();
    }
}
 
Example 11
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 12
Source File: BitsArrayTest.java    From rocketmq with Apache License 2.0 5 votes vote down vote up
@Test
public void testOr() {
    BitsArray b1 = BitsArray.create(new byte[] {(byte) 0xff, 0x00});
    BitsArray b2 = BitsArray.create(new byte[] {0x00, (byte) 0xff});

    b1.or(b2);

    for (int i = 0; i < b1.bitLength(); i++) {
        assertThat(b1.getBit(i)).isTrue();
    }
}