wil*_*824 1 java enums flags bitwise-operators
问候,
我找到了一个使用Flag的C++遗留代码,后来根据完成的读取更新了标志的状态:
主文件:
#define VINCULACION 0x00000004L
#define DET_VINCULACION 0x00000008L
long unsigned FlagRead ;
int formerMethod(){
if ((FlagRead & VINCULACION)==0) ReadVinculacion();
//... DO MORE
}
int ReadVinculacion(){
//.. Do DB operations to read Vinculacion variables.
FlagRead|=VINCULACION;
return 1;
}
//.. Same similar methods to ensure reading DET_VINCULACION but not doing it twice.
Run Code Online (Sandbox Code Playgroud)
现在用Java开发我没有使用带有整数或长整数的常量作为使用枚举的好习惯.
是否有一种性能明智和可靠的方法来使用java下的枚举执行相同的任务?
谢谢!