List of usage examples for com.google.common.collect Sets immutableEnumSet
@GwtCompatible(serializable = true) public static <E extends Enum<E>> ImmutableSet<E> immutableEnumSet(Iterable<E> elements)
From source file:org.trustedanalytics.user.manageusers.CfUsersService.java
private void inviteUserToSpace(String username, String currentUser, UUID orgGuid, UUID spaceGuid, Set<Role> roles) { AccessInvitationsService.CreateOrUpdateState state = accessInvitationsService .createOrUpdateInvitation(username, ui -> { ui.addOrgAccessInvitation(orgGuid, Sets.immutableEnumSet(Role.USERS)); ui.addSpaceAccessInvitation(spaceGuid, roles); });/*w ww . j a v a 2 s .com*/ if (state == AccessInvitationsService.CreateOrUpdateState.CREATED) { invitationsService.sendInviteEmail(username, currentUser); } }
From source file:org.csstudio.utility.ldap.treeconfiguration.LdapEpicsAlarmcfgConfiguration.java
/** * {@inheritDoc} */ @Override public ImmutableSet<LdapEpicsAlarmcfgConfiguration> getNestedContainerTypes() { return Sets.immutableEnumSet(_nestedClasses); }
From source file:com.opengamma.basics.date.ImmutableHolidayCalendar.java
/** * Obtains a {@code HolidayCalendar} from a set of holiday dates and weekend days. * <p>/* w w w .j a v a2s . 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 be empty, in which case the holiday dates should contain any weekends. * * @param name the calendar name * @param holidays the set of holiday dates * @param weekendDays the days that define the weekend, if empty then weekends are treated as business days * @return the holiday calendar */ public static ImmutableHolidayCalendar of(String name, Iterable<LocalDate> holidays, Iterable<DayOfWeek> weekendDays) { ArgChecker.notNull(name, "name"); ArgChecker.noNulls(holidays, "holidays"); ArgChecker.noNulls(weekendDays, "weekendDays"); return new ImmutableHolidayCalendar(name, ImmutableSortedSet.copyOf(holidays), Sets.immutableEnumSet(weekendDays)); }
From source file:org.trnltk.morphology.phonetics.PhoneticsAnalyzer.java
public ImmutableSet<PhoneticAttribute> calculateNewPhoneticAttributes(Set<PhoneticAttribute> phoneticAttributes, char charToApply) { final TurkishChar turkishChar = TurkishAlphabet.getChar(charToApply); final TurkicLetter letter = turkishChar.getLetter(); final EnumSet<PhoneticAttribute> newAttributes = EnumSet.copyOf(phoneticAttributes); if (letter.isVowel()) { newAttributes.remove(PhoneticAttribute.LastLetterConsonant); newAttributes.remove(PhoneticAttribute.LastLetterVoiceless); newAttributes.remove(PhoneticAttribute.LastLetterVoicelessStop); newAttributes.remove(PhoneticAttribute.HasNoVowel); newAttributes.remove(PhoneticAttribute.LastVowelFrontal); newAttributes.remove(PhoneticAttribute.LastVowelBack); newAttributes.remove(PhoneticAttribute.LastVowelRounded); newAttributes.remove(PhoneticAttribute.LastVowelUnrounded); newAttributes.add(PhoneticAttribute.LastLetterVowel); newAttributes.add(PhoneticAttribute.LastLetterNotVoiceless); if (letter.isFrontal()) newAttributes.add(PhoneticAttribute.LastVowelFrontal); else/*from www . ja v a 2s .com*/ newAttributes.add(PhoneticAttribute.LastVowelBack); if (letter.isRounded()) newAttributes.add(PhoneticAttribute.LastVowelRounded); else newAttributes.add(PhoneticAttribute.LastVowelUnrounded); } else { newAttributes.remove(PhoneticAttribute.LastLetterVowel); newAttributes.remove(PhoneticAttribute.LastLetterVoiceless); newAttributes.remove(PhoneticAttribute.LastLetterNotVoiceless); newAttributes.remove(PhoneticAttribute.LastLetterVoicelessStop); newAttributes.add(PhoneticAttribute.LastLetterConsonant); if (letter.isVoiceless()) { newAttributes.add(PhoneticAttribute.LastLetterVoiceless); if (!letter.isContinuant()) newAttributes.add(PhoneticAttribute.LastLetterVoicelessStop); } else { newAttributes.add(PhoneticAttribute.LastLetterNotVoiceless); } } return Sets.immutableEnumSet(newAttributes); }
From source file:de.metas.ui.web.window.descriptor.DocumentFieldDescriptor.java
private DocumentFieldDescriptor(final Builder builder) { fieldName = Preconditions.checkNotNull(builder.fieldName, "name is null"); caption = builder.getCaption();/* w w w . ja v a 2 s. co m*/ description = builder.getDescription(); detailId = builder.getDetailId(); key = builder.isKey(); calculated = builder.isCalculated(); parentLink = builder.parentLink; parentLinkFieldName = builder.parentLinkFieldName; widgetType = builder.getWidgetType(); widgetSize = builder.getWidgetSize(); allowShowPassword = builder.isAllowShowPassword(); buttonActionDescriptor = builder.getButtonActionDescriptor(); valueClass = builder.getValueClass(); lookupDescriptorProvider = builder.getLookupDescriptorProvider(); supportZoomInto = builder.isSupportZoomInto(); defaultValueExpression = Preconditions.checkNotNull(builder.defaultValueExpression, "defaultValueExpression not null"); virtualField = builder.isVirtualField(); virtualFieldValueProvider = builder.getVirtualFieldValueProvider(); characteristics = Sets.immutableEnumSet(builder.characteristics); readonlyLogic = builder.getReadonlyLogicEffective(); alwaysUpdateable = builder.alwaysUpdateable; displayLogic = builder.displayLogic; mandatoryLogic = builder.getMandatoryLogicEffective(); dataBinding = builder.getDataBinding(); dependencies = builder.buildDependencies(); callouts = builder.buildCallouts(); // // Default filtering defaultFilterInfo = builder.defaultFilterInfo; }
From source file:org.obm.imap.archive.resources.TreatmentsResource.java
private Set<ArchiveStatus> statuses(Boolean filterFailure) { if (filterFailure == null || !filterFailure) { return ArchiveStatus.TERMINATED; }/*from ww w . ja va 2 s. c om*/ return Sets.immutableEnumSet(ArchiveStatus.ERROR); }
From source file:com.opengamma.basics.date.ImmutableHolidayCalendar.java
/** * Creates an instance calculating the supported range. * //from w w w .java 2 s . c om * @param name the calendar name * @param holidays the set of holidays, validated non-null * @param weekendDays the set of weekend days, validated non-null */ @ImmutableConstructor private ImmutableHolidayCalendar(String name, SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays) { ArgChecker.notNull(name, "name"); ArgChecker.notNull(holidays, "holidays"); ArgChecker.notNull(weekendDays, "weekendDays"); this.name = name; this.holidays = ImmutableSortedSet.copyOfSorted(holidays); this.weekendDays = Sets.immutableEnumSet(weekendDays); if (holidays.isEmpty()) { // special case where no holiday dates are specified this.range = LocalDateRange.ALL; this.startYear = 0; this.lookup = new int[0]; } else { // normal case where holidays are specified this.range = LocalDateRange.ofClosed(holidays.first().with(TemporalAdjusters.firstDayOfYear()), holidays.last().with(TemporalAdjusters.lastDayOfYear())); this.startYear = range.getStart().getYear(); int endYearExclusive = range.getEndExclusive().getYear(); this.lookup = buildLookupArray(holidays, weekendDays, startYear, endYearExclusive); } }
From source file:com.opengamma.strata.basics.date.ImmutableHolidayCalendar.java
/** * Creates an instance calculating the supported range. * /*from w w w . j a va 2s . com*/ * @param name the calendar name * @param holidays the set of holidays, validated non-null * @param weekendDays the set of weekend days, validated non-null */ @ImmutableConstructor private ImmutableHolidayCalendar(HolidayCalendarId id, SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays) { ArgChecker.notNull(id, "id"); ArgChecker.notNull(holidays, "holidays"); ArgChecker.notNull(weekendDays, "weekendDays"); this.id = id; this.holidays = ImmutableSortedSet.copyOfSorted(holidays); this.weekendDays = Sets.immutableEnumSet(weekendDays); if (holidays.isEmpty()) { // special case where no holiday dates are specified this.startYear = 0; this.lookup = new int[0]; } else { // normal case where holidays are specified this.startYear = holidays.first().getYear(); int endYearExclusive = holidays.last().getYear() + 1; this.lookup = buildLookupArray(holidays, weekendDays, startYear, endYearExclusive); } }
From source file:com.android.build.gradle.internal.transforms.InstantRunDex.java
@NonNull @Override public Set<QualifiedContent.Scope> getReferencedScopes() { return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT); }
From source file:org.trnltk.morphology.lexicon.ImmutableRootGenerator.java
private HashSet<ImmutableRoot> handleSpecialRoots(final Lexeme originalLexeme) { String changedRootStr = rootChanges.get(Pair.of(originalLexeme.getLemma(), originalLexeme.getPrimaryPos())); if (StringUtils.isBlank(changedRootStr)) changedRootStr = rootChanges.get(Pair.of(originalLexeme.getLemma(), (PrimaryPos) null)); Validate.notNull(changedRootStr, "Unhandled root change : " + originalLexeme); final Set<LexemeAttribute> attributes = originalLexeme.getAttributes(); final EnumSet<LexemeAttribute> newAttributes = EnumSet.copyOf(attributes); newAttributes.remove(LexemeAttribute.Special); final Lexeme modifiedLexeme = new ImmutableLexeme(originalLexeme.getLemma(), originalLexeme.getLemmaRoot(), originalLexeme.getPrimaryPos(), originalLexeme.getSecondaryPos(), Sets.immutableEnumSet(newAttributes)); final String unchangedRootStr = originalLexeme.getLemmaRoot(); final ImmutableRoot rootUnchanged = new ImmutableRoot(unchangedRootStr, modifiedLexeme, Sets.immutableEnumSet(phoneticsAnalyzer.calculatePhoneticAttributes(unchangedRootStr, modifiedLexeme.getAttributes())), null);/*ww w . j a v a 2s .c o m*/ final ImmutableRoot rootChanged = new ImmutableRoot(changedRootStr, modifiedLexeme, Sets.immutableEnumSet( phoneticsAnalyzer.calculatePhoneticAttributes(changedRootStr, modifiedLexeme.getAttributes())), null); return Sets.newHashSet(rootUnchanged, rootChanged); }