Example usage for com.google.common.collect Sets immutableEnumSet

List of usage examples for com.google.common.collect Sets immutableEnumSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets immutableEnumSet.

Prototype


@GwtCompatible(serializable = true)
public static <E extends Enum<E>> ImmutableSet<E> immutableEnumSet(E anElement, E... otherElements) 

Source Link

Document

Returns an immutable set instance containing the given enum elements.

Usage

From source file:co.mitro.core.server.data.DBAcl.java

public static Set<AccessLevelType> modifyGroupSecretsAccess() {
    return Sets.immutableEnumSet(AccessLevelType.ADMIN, AccessLevelType.MODIFY_SECRETS_BUT_NOT_MEMBERSHIP);
}

From source file:com.opengamma.strata.basics.date.ImmutableHolidayCalendar.java

/**
 * Obtains an instance from a set of holiday dates and weekend days.
 * <p>//from  w w  w.  ja v a  2s.  com
 * The holiday dates will be extracted into a set with duplicates ignored.
 * The minimum supported date for query is the start of the year of the earliest holiday.
 * The maximum supported date for query is the end of the year of the latest holiday.
 * <p>
 * The weekend days may both be the same.
 * 
 * @param id  the identifier
 * @param holidays  the set of holiday dates
 * @param firstWeekendDay  the first weekend day
 * @param secondWeekendDay  the second weekend day, may be same as first
 * @return the holiday calendar
 */
public static ImmutableHolidayCalendar of(HolidayCalendarId id, Iterable<LocalDate> holidays,
        DayOfWeek firstWeekendDay, DayOfWeek secondWeekendDay) {
    ImmutableSet<DayOfWeek> weekendDays = Sets.immutableEnumSet(firstWeekendDay, secondWeekendDay);
    return new ImmutableHolidayCalendar(id, ImmutableSortedSet.copyOf(holidays), weekendDays);
}

From source file:com.android.build.gradle.internal.transforms.InstantRunTransform.java

@NonNull
@Override
public Set<QualifiedContent.Scope> getScopes() {
    return Sets.immutableEnumSet(Scope.PROJECT, Scope.SUB_PROJECTS);
}

From source file:com.opengamma.basics.date.ImmutableHolidayCalendar.java

/**
 * Obtains a {@code HolidayCalendar} from a set of holiday dates and weekend days.
 * <p>/*ww w  .jav  a2 s  .c o m*/
 * The holiday dates will be extracted into a set with duplicates ignored.
 * The minimum supported date for query is the start of the year of the earliest holiday.
 * The maximum supported date for query is the end of the year of the latest holiday.
 * <p>
 * The weekend days may both be the same.
 * 
 * @param name  the calendar name
 * @param holidays  the set of holiday dates
 * @param firstWeekendDay  the first weekend day
 * @param secondWeekendDay  the second weekend day, may be same as first
 * @return the holiday calendar
 */
public static ImmutableHolidayCalendar of(String name, Iterable<LocalDate> holidays, DayOfWeek firstWeekendDay,
        DayOfWeek secondWeekendDay) {
    ArgChecker.notNull(name, "name");
    ArgChecker.noNulls(holidays, "holidays");
    ArgChecker.notNull(firstWeekendDay, "firstWeekendDay");
    ArgChecker.notNull(secondWeekendDay, "secondWeekendDay");
    ImmutableSet<DayOfWeek> weekendDays = Sets.immutableEnumSet(firstWeekendDay, secondWeekendDay);
    return new ImmutableHolidayCalendar(name, ImmutableSortedSet.copyOf(holidays), weekendDays);
}

From source file:com.android.build.gradle.internal.transforms.InstantRunSlicer.java

@NonNull
@Override//from w w w.  ja  va  2  s  .c o  m
public Set<Scope> getScopes() {
    // if we are targeting a N and above, it's fine to merge all the dependencies.jar inside
    // the dependencies.jar file as the VM team fixed the issue around split java packages
    // landing in two different dex files.
    return patchingPolicy.getDexPatchingPolicy() == DexPackagingPolicy.INSTANT_RUN_MULTI_APK
            ? TransformManager.SCOPE_FULL_PROJECT
            : Sets.immutableEnumSet(Scope.PROJECT, Scope.SUB_PROJECTS);
}

From source file:com.android.build.gradle.internal.transforms.JackTransform.java

@NonNull
@Override
public Set<QualifiedContent.Scope> getReferencedScopes() {
    return Sets.immutableEnumSet(QualifiedContent.Scope.PROVIDED_ONLY, QualifiedContent.Scope.TESTED_CODE);
}

From source file:edu.udo.scaffoldhunter.model.dataimport.ImportJob.java

/**
 * @return a combobox model which allows setting the structure merge
 *         strategy/* w ww.  ja  v  a 2 s  .c o  m*/
 */
public ComboBoxModel getStructureMergeStrategyModel() {
    class StructureMergeStrategyModel extends AbstractListModel implements ComboBoxModel {

        private final ImmutableSet<MergeStrategy> validStrategies = Sets
                .immutableEnumSet(MergeStrategy.OVERWRITE, MergeStrategy.DONT_OVERWRITE);

        /*
         * (non-Javadoc)
         * 
         * @see javax.swing.ListModel#getElementAt(int)
         */
        @Override
        public Object getElementAt(int index) {
            return Iterables.get(validStrategies, index);
        }

        /*
         * (non-Javadoc)
         * 
         * @see javax.swing.ListModel#getSize()
         */
        @Override
        public int getSize() {
            return validStrategies.size();
        }

        /*
         * (non-Javadoc)
         * 
         * @see javax.swing.ComboBoxModel#getSelectedItem()
         */
        @Override
        public Object getSelectedItem() {
            return structureMergeStrategy;
        }

        /*
         * (non-Javadoc)
         * 
         * @see javax.swing.ComboBoxModel#setSelectedItem(java.lang.Object)
         */
        @Override
        public void setSelectedItem(Object strategy) {
            assert (validStrategies.contains(strategy));
            structureMergeStrategy = (MergeStrategy) strategy;
        }

    }
    return new StructureMergeStrategyModel();
}

From source file:com.android.build.gradle.internal.transforms.InstantRunSlicer.java

private static File getOutputStreamForFile(@NonNull TransformOutputProvider transformOutputProvider,
        @NonNull DirectoryInput input, @NonNull File file, @NonNull Slices slices) {

    String relativePackagePath = FileUtils.relativePossiblyNonExistingPath(file.getParentFile(),
            input.getFile());//  w  w  w.j av a  2  s .co m
    if (input.getScopes().contains(Scope.PROJECT) || input.getScopes().contains(Scope.SUB_PROJECTS)) {

        Slice slice = slices.getSliceFor(new Slice.SlicedElement(relativePackagePath, file));
        return transformOutputProvider.getContentLocation(slice.name, TransformManager.CONTENT_CLASS,
                Sets.immutableEnumSet(Scope.PROJECT, Scope.SUB_PROJECTS), Format.DIRECTORY);
    } else {
        return getDependenciesSliceOutputFolder(transformOutputProvider, Format.DIRECTORY);
    }
}

From source file:com.android.build.gradle.internal.transforms.InstantRunVerifierTransform.java

@NonNull
@Override
public Set<QualifiedContent.Scope> getReferencedScopes() {
    return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT, QualifiedContent.Scope.SUB_PROJECTS);
}

From source file:com.android.build.gradle.internal.transforms.InstantRunSlicer.java

@NonNull
private static File getMainSliceOutputFolder(@NonNull TransformOutputProvider outputProvider,
        @Nullable String suffix) throws IOException {
    File outputFolder = outputProvider.getContentLocation(MAIN_SLICE_NAME + Strings.nullToEmpty(suffix),
            TransformManager.CONTENT_CLASS, Sets.immutableEnumSet(Scope.PROJECT, Scope.SUB_PROJECTS),
            Format.JAR);//from  ww w .j a v  a  2 s . c om
    Files.createParentDirs(outputFolder);
    return outputFolder;
}