All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nativelibs4java.util.ValuedEnums Maven / Gradle / Ivy

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nativelibs4java.util;

import java.util.EnumSet;

/**
 *
 * @author ochafik
 */
public class ValuedEnums {
	public static > long or(EnumSet enums) {
		long value = 0;
		for (E e : enums)
			value |= ((ValuedEnum)e).value();
		return value;
	}
	public static > long and(EnumSet enums) {
		long value = 0;
		boolean first = true;
		for (E e : enums) {
			long ev = ((ValuedEnum)e).value();
			if (first) {
				value = ev;
				first = false;
			} else
				value &= ev;
		}
		return value;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy