@Test public void setFlags() { pdc.setFlags(true, ReadingMethod.UNKNOWN, VerificationMethod.UNKNOWN, POSEnvironment.UNKNOWN, SecurityCharacteristic.UNKNOWN); for (int i = 0x80000000; i != 1; i>>>=1) { assertFalse(pdc.hasReadingMethods(i), "Only UNKNOWN reading method should be set"); assertFalse(pdc.hasVerificationMethods(i), "Only UNKNOWN verification method should be set"); assertFalse(pdc.hasPosEnvironments(i), "Only UNKNOWN pos environment should be set"); assertFalse(pdc.hasSecurityCharacteristics(i), "Only UNKNOWN security characteristic should be set"); } assertTrue(pdc.hasReadingMethods(1), "UNKNOWN reading method should be set"); assertTrue(pdc.hasVerificationMethods(1), "UNKNOWN verification method should be set"); assertTrue(pdc.hasPosEnvironments(1), "UNKNOWN pos environment should be set"); assertTrue(pdc.hasSecurityCharacteristics(1), "UNKNOWN security characteristic should be set"); pdc.setFlags(false, ReadingMethod.UNKNOWN, VerificationMethod.UNKNOWN, POSEnvironment.UNKNOWN, SecurityCharacteristic.UNKNOWN); for (int i = 0x80000000; i != 0; i>>>=1) { assertFalse(pdc.hasReadingMethods(i), "No reading method should be set"); assertFalse(pdc.hasVerificationMethods(i), "No verification method should be set"); assertFalse(pdc.hasPosEnvironments(i), "No pos environment should be set"); assertFalse(pdc.hasSecurityCharacteristics(i), "No security characteristic should be set"); } pdc.setFlags(true, CONTACTLESS, BARCODE, ONLINE_PIN, OFFLINE_PIN_IN_CLEAR, M_COMMERCE, RECURRING, PRIVATE_ALG_ENCRYPTION, PKI_ENCRYPTION); assertTrue(pdc.hasReadingMethods(CONTACTLESS.intValue() | BARCODE.intValue()), "Reding methods missing"); assertTrue(pdc.hasVerificationMethods(ONLINE_PIN.intValue() | OFFLINE_PIN_IN_CLEAR.intValue()), "Verification methods missing"); assertTrue(pdc.hasPosEnvironments(M_COMMERCE.intValue() | RECURRING.intValue()), "POS enironments missing"); assertTrue(pdc.hasSecurityCharacteristics(PRIVATE_ALG_ENCRYPTION.intValue() | PKI_ENCRYPTION.intValue()), "Security characteristics missing"); }
public void setFlags(boolean value, Flag... flags) { if (value) { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] |= (byte) v; } } } else { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] &= (byte) ~v; } } } }
PosDataCode implements Loggeable { public void setFlags(boolean value, Flag... flags) { if (value) { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] |= (byte) v; } } } else { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] &= (byte) ~v; } } } } }
PosDataCode implements Loggeable { public void setFlags(boolean value, Flag... flags) { if (value) { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] |= (byte) v; } } } else { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] &= (byte) ~v; } } } } PosDataCode();  PosDataCode(
            int readingMethod,
            int verificationMethod,
            int posEnvironment,
            int securityCharacteristic); private  PosDataCode(byte[] b); }
PosDataCode implements Loggeable { public void setFlags(boolean value, Flag... flags) { if (value) { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] |= (byte) v; } } } else { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] &= (byte) ~v; } } } } PosDataCode();  PosDataCode(
            int readingMethod,
            int verificationMethod,
            int posEnvironment,
            int securityCharacteristic); private  PosDataCode(byte[] b); boolean hasReadingMethods(int readingMethods); boolean hasReadingMethod(ReadingMethod method); boolean hasVerificationMethods(int verificationMethods); boolean hasVerificationMethod(VerificationMethod method); boolean hasPosEnvironments(int posEnvironments); boolean hasPosEnvironment(POSEnvironment method); boolean hasSecurityCharacteristics(int securityCharacteristics); boolean hasSecurityCharacteristic(SecurityCharacteristic characteristic); byte[] getBytes(); boolean isEMV(); boolean isManualEntry(); boolean isSwiped(); boolean isRecurring(); boolean isECommerce(); String toString(); static PosDataCode valueOf(byte[] b); void dump(PrintStream p, String indent); void setFlags(boolean value, Flag... flags); void setReadingMethods(boolean value, ReadingMethod ... methods ); void unsetReadingMethods(ReadingMethod ... methods ); void setReadingMethods(ReadingMethod ... methods ); void setVerificationMethods(boolean value, VerificationMethod ... methods ); void unsetVerificationMethods(VerificationMethod ... methods); void setVerificationMethods(VerificationMethod ... methods); void setPOSEnvironments(boolean value, POSEnvironment ... envs); void unsetPOSEnvironments(POSEnvironment ... envs); void setPOSEnvironments(POSEnvironment ... envs); void setSecurityCharacteristics(boolean value, SecurityCharacteristic ... securityCharacteristics); void unsetSecurityCharacteristics(SecurityCharacteristic ... envs); void setSecurityCharacteristics(SecurityCharacteristic ... envs); }
PosDataCode implements Loggeable { public void setFlags(boolean value, Flag... flags) { if (value) { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] |= (byte) v; } } } else { for (Flag flag : flags) { for (int v = flag.intValue(), offset = flag.getOffset(); v != 0; v >>>= 8, offset++) { b[offset] &= (byte) ~v; } } } } PosDataCode();  PosDataCode(
            int readingMethod,
            int verificationMethod,
            int posEnvironment,
            int securityCharacteristic); private  PosDataCode(byte[] b); boolean hasReadingMethods(int readingMethods); boolean hasReadingMethod(ReadingMethod method); boolean hasVerificationMethods(int verificationMethods); boolean hasVerificationMethod(VerificationMethod method); boolean hasPosEnvironments(int posEnvironments); boolean hasPosEnvironment(POSEnvironment method); boolean hasSecurityCharacteristics(int securityCharacteristics); boolean hasSecurityCharacteristic(SecurityCharacteristic characteristic); byte[] getBytes(); boolean isEMV(); boolean isManualEntry(); boolean isSwiped(); boolean isRecurring(); boolean isECommerce(); String toString(); static PosDataCode valueOf(byte[] b); void dump(PrintStream p, String indent); void setFlags(boolean value, Flag... flags); void setReadingMethods(boolean value, ReadingMethod ... methods ); void unsetReadingMethods(ReadingMethod ... methods ); void setReadingMethods(ReadingMethod ... methods ); void setVerificationMethods(boolean value, VerificationMethod ... methods ); void unsetVerificationMethods(VerificationMethod ... methods); void setVerificationMethods(VerificationMethod ... methods); void setPOSEnvironments(boolean value, POSEnvironment ... envs); void unsetPOSEnvironments(POSEnvironment ... envs); void setPOSEnvironments(POSEnvironment ... envs); void setSecurityCharacteristics(boolean value, SecurityCharacteristic ... securityCharacteristics); void unsetSecurityCharacteristics(SecurityCharacteristic ... envs); void setSecurityCharacteristics(SecurityCharacteristic ... envs);  }