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

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

 



Signed-off-by: Claudio Bley <cbley@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]