Example #1
0
  public static void testFlags() {
    final byte ONE = 1;
    final byte FIVE = 16;
    final byte SEVEN = 64;

    byte flags = 0;
    flags = Util.setFlag(flags, ONE);
    assert Util.isFlagSet(flags, ONE);

    flags = 0;
    flags = Util.setFlag(flags, (byte) (ONE | SEVEN));
    assert Util.isFlagSet(flags, ONE);
    assert Util.isFlagSet(flags, SEVEN);
    assert !Util.isFlagSet(flags, FIVE);
    flags = Util.clearFlags(flags, ONE);
    assert !Util.isFlagSet(flags, ONE);

    flags = Util.setFlag(flags, FIVE);
    assert Util.isFlagSet(flags, FIVE);
    assert Util.isFlagSet(flags, SEVEN);
  }
Example #2
0
 public RequestOptions clearFlags(byte flags) {
   this.flags = Util.clearFlags(this.flags, flags);
   return this;
 }