Example usage for com.google.common.collect ImmutableSet contains

List of usage examples for com.google.common.collect ImmutableSet contains

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet contains.

Prototype

boolean contains(Object o);

Source Link

Document

Returns true if this set contains the specified element.

Usage

From source file:ealvatag.DumpHeap.java

public static void main(String[] args) throws Exception {
    final SimpleDateFormat format = new SimpleDateFormat("-dd-MM-yy:HH:mm:SS");
    String heapDumpFileName = "heap" + format.format(new Date()) + ".bin";

    File inputFile = new File("ealvatag/testdata", "issue52.mp3");
    if (inputFile.exists()) {
        AudioFile audioFile = AudioFileIO.read(inputFile);
        final AudioHeader audioHeader = audioFile.getAudioHeader();
        final int channels = audioHeader.getChannelCount();
        final long bitRate = audioHeader.getBitRate();
        final String encodingType = audioHeader.getEncodingType();
        final Tag tag = audioFile.getTag().or(NullTag.INSTANCE);
        if (tag.hasField(FieldKey.TITLE)) {
            final String title = tag.getFirst(FieldKey.TITLE);
        }/*w ww .ja  va  2  s . c o  m*/
        final ImmutableSet<FieldKey> supportedFields = tag.getSupportedFields();
        if (supportedFields.contains(FieldKey.COVER_ART)) {
            System.out.println("File type supports Artwork");
        }
        tag.setField(FieldKey.TITLE, "My New Title");
        audioFile.save();
        System.out.println(audioHeader);
        System.out.println("Fields:" + Integer.toString(tag.getFieldCount()));

        dumpHeap(heapDumpFileName, true);
    } else {
        System.err.println(inputFile.getCanonicalPath() + " not found");
    }
}

From source file:com.stratio.morphlines.refererparser.Medium.java

public static boolean contains(String value) {
    final ImmutableSet<Medium> set = Sets.immutableEnumSet(Arrays.asList(Medium.values()));
    return set.contains(Medium.fromString(value));
}

From source file:com.vmware.photon.controller.api.frontend.entities.DiskStateChecks.java

public static void checkOperationState(BaseDiskEntity disk, Operation operation)
        throws InvalidOperationStateException {
    ImmutableSet<DiskState> states = DiskState.OPERATION_PREREQ_STATE.get(operation);
    if (states != null && !states.contains(disk.getState())) {
        throw new InvalidOperationStateException(disk, operation, disk.getState());
    }/*from   ww w .  j a  v  a  2s . co m*/
}

From source file:simpleserver.Group.java

public static boolean isMember(ImmutableSet<Integer> groups, Player player) {
    return groups.contains(player.getGroupId()) || groups.contains(-1)
            || (groups.contains(0) && (player.getGroupId() != -1));
}

From source file:uk.ac.ebi.atlas.model.ExperimentType.java

public static boolean containsDifferential(ImmutableSet<String> experimentTypes) {
    return experimentTypes.contains(RNASEQ_MRNA_DIFFERENTIAL.getDescription())
            || experimentTypes.contains(MICROARRAY_1COLOUR_MRNA_DIFFERENTIAL.getDescription())
            || experimentTypes.contains(MICROARRAY_2COLOUR_MRNA_DIFFERENTIAL.getDescription())
            || experimentTypes.contains(MICROARRAY_1COLOUR_MICRORNA_DIFFERENTIAL.getDescription());
}

From source file:com.google.devtools.build.buildjar.genclass.GenClass.java

/**
 * We want to include inner classes for generated source files, but a class whose name contains
 * '$' isn't necessarily an inner class. Check whether any prefix of the class name that ends with
 * '$' matches one of the top-level class names.
 *//*from  w ww  .j a v a 2s . c o m*/
private static boolean prefixesContains(ImmutableSet<String> prefixes, String className) {
    if (prefixes.contains(className)) {
        return true;
    }
    for (int i = className.indexOf('$'); i != -1; i = className.indexOf('$', i + 1)) {
        if (prefixes.contains(className.substring(0, i))) {
            return true;
        }
    }
    return false;
}

From source file:org.inferred.freebuilder.processor.BuilderFactory.java

/** Determines the correct way of constructing a default {@code builderType} instance, if any. */
public static Optional<BuilderFactory> from(TypeElement builderType) {
    ImmutableSet<String> staticMethods = findPotentialStaticFactoryMethods(builderType);
    if (staticMethods.contains("builder")) {
        return Optional.of(BUILDER_METHOD);
    } else if (staticMethods.contains("newBuilder")) {
        return Optional.of(NEW_BUILDER_METHOD);
    } else if (hasExplicitNoArgsConstructor(builderType)) {
        return Optional.of(NO_ARGS_CONSTRUCTOR);
    } else {//from   w w  w. j a v a  2s .c o m
        return Optional.absent();
    }
}

From source file:com.spectralogic.ds3autogen.c.helpers.C_TypeHelper.java

private static C_Type createType(final String type, final boolean isArray,
        final ImmutableSet<String> enumNames) {
    final String ds3TypeName = StructHelper.getDs3TypeName(type);
    if (enumNames.contains(ds3TypeName)) {
        return new PrimitiveType(ds3TypeName, isArray);
    }/*  w  w w.  j a v  a2s.c o  m*/

    switch (type) {
    case "java.lang.Boolean":
    case "boolean":
        return new PrimitiveType("ds3_bool", isArray);

    case "java.lang.Integer":
    case "int":
        return new PrimitiveType("int", isArray);

    case "java.lang.Long":
    case "long":
        return new PrimitiveType("uint64_t", isArray);

    case "java.lang.Double":
    case "double":
        return new PrimitiveType("float", isArray);

    case "java.lang.Object":
    case "java.lang.String":
    case "java.util.Date":
    case "java.util.UUID":
        return new FreeableType("ds3_str", isArray);

    default:
        return new FreeableType(StructHelper.getResponseTypeName(type), isArray);
    }
}

From source file:com.google.jimfs.Options.java

/**
 * Returns an immutable set of the given options for a copy.
 *///from   w w  w.  j  a v  a 2 s  . c o  m
public static ImmutableSet<CopyOption> getCopyOptions(CopyOption... options) {
    ImmutableSet<CopyOption> result = ImmutableSet.copyOf(options);
    if (result.contains(ATOMIC_MOVE)) {
        throw new UnsupportedOperationException("'ATOMIC_MOVE' not allowed");
    }
    return result;
}

From source file:com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils.java

public static boolean validateStatusCode(final int statusCode, final int... expectedStatuses) {
    Preconditions.checkElementIndex(0, 1);
    final ImmutableSet<Integer> expectedSet = createExpectedSet(expectedStatuses);
    return expectedSet.contains(statusCode);
}