[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-java] [PATCH 61/65] Add helper for handling bit-flags



Signed-off-by: Claudio Bley <cbley av-test de>
---
 src/main/java/org/libvirt/BitFlags.java |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 src/main/java/org/libvirt/BitFlags.java

diff --git a/src/main/java/org/libvirt/BitFlags.java b/src/main/java/org/libvirt/BitFlags.java
new file mode 100644
index 0000000..f078c6c
--- /dev/null
+++ b/src/main/java/org/libvirt/BitFlags.java
@@ -0,0 +1,18 @@
+package org.libvirt;
+
+public interface BitFlags {
+    int getBit();
+}
+
+final class BitFlagsHelper {
+    // bitwise-OR
+    static int OR(BitFlags[] flags) {
+        int ret = 0;
+        for (BitFlags f: flags) {
+            ret |= f.getBit();
+        }
+        return ret;
+    }
+
+    final static BitFlags[] NONE = {};
+}
-- 
1.7.9.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]