本文整理汇总了Java中java.util.EnumSet.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java EnumSet.isEmpty方法的具体用法?Java EnumSet.isEmpty怎么用?Java EnumSet.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.EnumSet
的用法示例。
在下文中一共展示了EnumSet.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapOptions
import java.util.EnumSet; //导入方法依赖的package包/类
public CodeCacheOptions mapOptions(EnumSet<BlobType> involvedCodeHeaps) {
if (involvedCodeHeaps.isEmpty()
|| involvedCodeHeaps.equals(NON_SEGMENTED_HEAPS)
|| involvedCodeHeaps.equals(ALL_SEGMENTED_HEAPS)) {
return this;
} else if (involvedCodeHeaps.equals(SEGMENTED_HEAPS_WO_PROFILED)) {
return new CodeCacheOptions(reserved, nonNmethods,
profiled + nonProfiled, 0L);
} else if (involvedCodeHeaps.equals(ONLY_NON_METHODS_HEAP)) {
return new CodeCacheOptions(reserved, nonNmethods + profiled
+ nonProfiled, 0L, 0L);
} else {
throw new Error("Test bug: unexpected set of code heaps involved "
+ "into test.");
}
}
示例2: getApplicationReports
import java.util.EnumSet; //导入方法依赖的package包/类
private List<ApplicationReport> getApplicationReports(
List<ApplicationReport> applicationReports,
Set<String> applicationTypes, EnumSet<YarnApplicationState> applicationStates) {
List<ApplicationReport> appReports = new ArrayList<ApplicationReport>();
for (ApplicationReport appReport : applicationReports) {
if (applicationTypes != null && !applicationTypes.isEmpty()) {
if (!applicationTypes.contains(appReport.getApplicationType())) {
continue;
}
}
if (applicationStates != null && !applicationStates.isEmpty()) {
if (!applicationStates.contains(appReport.getYarnApplicationState())) {
continue;
}
}
appReports.add(appReport);
}
return appReports;
}
示例3: getWeakPower
import java.util.EnumSet; //导入方法依赖的package包/类
public int getWeakPower(BlockFace side) {
if (!this.canProvidePower) {
return 0;
} else {
int power = this.meta;
if (power == 0) {
return 0;
} else if (side == BlockFace.UP) {
return power;
} else {
EnumSet<BlockFace> enumset = EnumSet.noneOf(BlockFace.class);
for (BlockFace face : Plane.HORIZONTAL) {
if (this.isPowerSourceAt(face)) {
enumset.add(face);
}
}
if (side.getAxis().isHorizontal() && enumset.isEmpty()) {
return power;
} else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY())) {
return power;
} else {
return 0;
}
}
}
}
示例4: check
import java.util.EnumSet; //导入方法依赖的package包/类
private boolean check(ElementKind kind, Set<Modifier> modifiers) {
if (this.kind != kind)
return false;
if (modifiers == null || modifiers.isEmpty())
return mods.isEmpty();
if (!modifiers.containsAll(this.mods))
return false;
EnumSet<Modifier> copy = EnumSet.copyOf(modifiers);
copy.removeAll(this.mods);
copy.retainAll(ignoreVisibility? EnumSet.of(Modifier.STATIC)
: EnumSet.of(Modifier.STATIC, Modifier.PUBLIC, Modifier.PRIVATE, Modifier.PROTECTED));
return copy.isEmpty();
}
示例5: toString
import java.util.EnumSet; //导入方法依赖的package包/类
/** Convert an EnumSet to a string of comma separated values. */
static <E extends Enum<E>> String toString(EnumSet<E> set) {
if (set == null || set.isEmpty()) {
return "";
} else {
final StringBuilder b = new StringBuilder();
final Iterator<E> i = set.iterator();
b.append(i.next());
for(; i.hasNext(); ) {
b.append(',').append(i.next());
}
return b.toString();
}
}
示例6: build
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Creates a new {@link ConnectionProfile} based on the added connections.
* @throws IllegalStateException if any of the {@link org.elasticsearch.transport.TransportRequestOptions.Type} enum is missing
*/
public ConnectionProfile build() {
EnumSet<TransportRequestOptions.Type> types = EnumSet.allOf(TransportRequestOptions.Type.class);
types.removeAll(addedTypes);
if (types.isEmpty() == false) {
throw new IllegalStateException("not all types are added for this connection profile - missing types: " + types);
}
return new ConnectionProfile(Collections.unmodifiableList(handles), offset, connectTimeout, handshakeTimeout);
}
示例7: toString
import java.util.EnumSet; //导入方法依赖的package包/类
/** Convert an EnumSet to a string of comma separated values. */
public static <E extends Enum<E>> String toString(EnumSet<E> set) {
if (set == null || set.isEmpty()) {
return "";
} else {
final StringBuilder b = new StringBuilder();
final Iterator<E> i = set.iterator();
b.append(i.next());
while (i.hasNext()) {
b.append(',').append(i.next());
}
return b.toString();
}
}
示例8: getWeakPower
import java.util.EnumSet; //导入方法依赖的package包/类
public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side) {
if (!this.canProvidePower) {
return 0;
} else {
int i = ((Integer) state.getValue(POWER)).intValue();
if (i == 0) {
return 0;
} else if (side == EnumFacing.UP) {
return i;
} else {
EnumSet<EnumFacing> enumset = EnumSet.<EnumFacing> noneOf(EnumFacing.class);
for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
EnumFacing enumfacing = (EnumFacing) enumfacing0;
if (this.func_176339_d(worldIn, pos, enumfacing)) {
enumset.add(enumfacing);
}
}
if (side.getAxis().isHorizontal() && enumset.isEmpty()) {
return i;
} else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW())
&& !enumset.contains(side.rotateY())) {
return i;
} else {
return 0;
}
}
}
}
示例9: assertSetOfTypesIsEqual
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Asserts the the set of rsa given are equal.
*
* @param message A detail message to record if the assertion fails.
* @param expected A list of expected condition rsa.
* @param actual A set of condition rsa to compare against the ones expected.
*/
public static void assertSetOfTypesIsEqual(
final String message, final List<String> expected, final EnumSet<CryptoConditionType> actual
) {
final EnumSet<CryptoConditionType> expectedSet = CryptoConditionType
.getEnumOfTypesFromString(String.join(",", expected.toArray(new String[expected.size()])));
if (!expectedSet.containsAll(actual)) {
throw new AssertionError(message + " - expected does not contain all values from actual.");
}
expectedSet.removeAll(actual);
if (!expectedSet.isEmpty()) {
throw new AssertionError(message + " - expected contains values not in actual.");
}
}
示例10: listApplications
import java.util.EnumSet; //导入方法依赖的package包/类
/**
* Lists the applications matching the given application Types And application
* States present in the Resource Manager
*
* @param appTypes
* @param appStates
* @throws YarnException
* @throws IOException
*/
private void listApplications(Set<String> appTypes,
EnumSet<YarnApplicationState> appStates) throws YarnException,
IOException {
PrintWriter writer = new PrintWriter(
new OutputStreamWriter(sysout, Charset.forName("UTF-8")));
if (allAppStates) {
for (YarnApplicationState appState : YarnApplicationState.values()) {
appStates.add(appState);
}
} else {
if (appStates.isEmpty()) {
appStates.add(YarnApplicationState.RUNNING);
appStates.add(YarnApplicationState.ACCEPTED);
appStates.add(YarnApplicationState.SUBMITTED);
}
}
List<ApplicationReport> appsReport = client.getApplications(appTypes,
appStates);
writer.println("Total number of applications (application-types: "
+ appTypes + " and states: " + appStates + ")" + ":"
+ appsReport.size());
writer.printf(APPLICATIONS_PATTERN, "Application-Id", "Application-Name",
"Application-Type", "User", "Queue", "State", "Final-State",
"Progress", "Tracking-URL");
for (ApplicationReport appReport : appsReport) {
DecimalFormat formatter = new DecimalFormat("###.##%");
String progress = formatter.format(appReport.getProgress());
writer.printf(APPLICATIONS_PATTERN, appReport.getApplicationId(),
appReport.getName(), appReport.getApplicationType(), appReport
.getUser(), appReport.getQueue(), appReport
.getYarnApplicationState(),
appReport.getFinalApplicationStatus(), progress, appReport
.getOriginalTrackingUrl());
}
writer.flush();
}
示例11: getApplicationReports
import java.util.EnumSet; //导入方法依赖的package包/类
private List<ApplicationReport> getApplicationReports(
List<ApplicationReport> applicationReports,
Set<String> appTypes, EnumSet<YarnApplicationState> appStates,
boolean allStates) {
List<ApplicationReport> appReports = new ArrayList<ApplicationReport>();
if (allStates) {
for(YarnApplicationState state : YarnApplicationState.values()) {
appStates.add(state);
}
}
for (ApplicationReport appReport : applicationReports) {
if (appTypes != null && !appTypes.isEmpty()) {
if (!appTypes.contains(appReport.getApplicationType())) {
continue;
}
}
if (appStates != null && !appStates.isEmpty()) {
if (!appStates.contains(appReport.getYarnApplicationState())) {
continue;
}
}
appReports.add(appReport);
}
return appReports;
}
示例12: containsStatus
import java.util.EnumSet; //导入方法依赖的package包/类
public boolean containsStatus (Set<Status> includeStatus) {
EnumSet<Status> intersection = status.clone();
intersection.retainAll(includeStatus);
return !intersection.isEmpty();
}
示例13: getWeakPower
import java.util.EnumSet; //导入方法依赖的package包/类
public int getWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
{
if (!this.canProvidePower)
{
return 0;
}
else
{
int i = ((Integer)state.getValue(POWER)).intValue();
if (i == 0)
{
return 0;
}
else if (side == EnumFacing.UP)
{
return i;
}
else
{
EnumSet<EnumFacing> enumset = EnumSet.<EnumFacing>noneOf(EnumFacing.class);
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
if (this.func_176339_d(worldIn, pos, enumfacing))
{
enumset.add(enumfacing);
}
}
if (side.getAxis().isHorizontal() && enumset.isEmpty())
{
return i;
}
else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY()))
{
return i;
}
else
{
return 0;
}
}
}
}
示例14: getWeakPower
import java.util.EnumSet; //导入方法依赖的package包/类
public int getWeakPower(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
if (!this.canProvidePower)
{
return 0;
}
else
{
int i = ((Integer)blockState.getValue(POWER)).intValue();
if (i == 0)
{
return 0;
}
else if (side == EnumFacing.UP)
{
return i;
}
else
{
EnumSet<EnumFacing> enumset = EnumSet.<EnumFacing>noneOf(EnumFacing.class);
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
if (this.isPowerSourceAt(blockAccess, pos, enumfacing))
{
enumset.add(enumfacing);
}
}
if (side.getAxis().isHorizontal() && enumset.isEmpty())
{
return i;
}
else if (enumset.contains(side) && !enumset.contains(side.rotateYCCW()) && !enumset.contains(side.rotateY()))
{
return i;
}
else
{
return 0;
}
}
}
}
示例15: substBounds
import java.util.EnumSet; //导入方法依赖的package包/类
/** replace types in all bounds - this might trigger listener notification */
public void substBounds(List<Type> from, List<Type> to, Types types) {
List<Type> instVars = from.diff(to);
//if set of instantiated ivars is empty, there's nothing to do!
if (instVars.isEmpty()) return;
final EnumSet<InferenceBound> boundsChanged = EnumSet.noneOf(InferenceBound.class);
UndetVarListener prevListener = listener;
try {
//setup new listener for keeping track of changed bounds
listener = new UndetVarListener() {
public void varChanged(UndetVar uv, Set<InferenceBound> ibs) {
boundsChanged.addAll(ibs);
}
};
for (Map.Entry<InferenceBound, List<Type>> _entry : bounds.entrySet()) {
InferenceBound ib = _entry.getKey();
List<Type> prevBounds = _entry.getValue();
ListBuffer<Type> newBounds = new ListBuffer<>();
ListBuffer<Type> deps = new ListBuffer<>();
//step 1 - re-add bounds that are not dependent on ivars
for (Type t : prevBounds) {
if (!t.containsAny(instVars)) {
newBounds.append(t);
} else {
deps.append(t);
}
}
//step 2 - replace bounds
bounds.put(ib, newBounds.toList());
//step 3 - for each dependency, add new replaced bound
for (Type dep : deps) {
addBound(ib, types.subst(dep, from, to), types, true);
}
}
} finally {
listener = prevListener;
if (!boundsChanged.isEmpty()) {
notifyChange(boundsChanged);
}
}
}