com.google.common.collect.Sets#immutableEnumSet ( )源码实例Demo

下面列出了com.google.common.collect.Sets#immutableEnumSet ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Bats   文件: RexSimplify.java
SafeRexVisitor() {
    Set<SqlKind> safeOps = EnumSet.noneOf(SqlKind.class);

    safeOps.addAll(SqlKind.COMPARISON);
    safeOps.add(SqlKind.PLUS);
    safeOps.add(SqlKind.MINUS);
    safeOps.add(SqlKind.TIMES);
    safeOps.add(SqlKind.IS_FALSE);
    safeOps.add(SqlKind.IS_NOT_FALSE);
    safeOps.add(SqlKind.IS_TRUE);
    safeOps.add(SqlKind.IS_NOT_TRUE);
    safeOps.add(SqlKind.IS_NULL);
    safeOps.add(SqlKind.IS_NOT_NULL);
    safeOps.add(SqlKind.IN);
    safeOps.add(SqlKind.NOT_IN);
    safeOps.add(SqlKind.OR);
    safeOps.add(SqlKind.AND);
    safeOps.add(SqlKind.NOT);
    safeOps.add(SqlKind.CASE);
    safeOps.add(SqlKind.LIKE);
    safeOps.add(SqlKind.COALESCE);
    this.safeOps = Sets.immutableEnumSet(safeOps);
}
 
源代码2 项目: batfish   文件: BgpSessionProperties.java
private BgpSessionProperties(
    Collection<Type> addressFamilies,
    Map<Type, RouteExchange> routeExchangeSettings,
    long tailAs,
    long headAs,
    Ip tailIp,
    Ip headIp,
    SessionType sessionType,
    ConfedSessionType confedType) {
  _addressFamilies = Sets.immutableEnumSet(addressFamilies);
  _routeExchangeSettings = ImmutableMap.copyOf(routeExchangeSettings);
  _tailAs = tailAs;
  _headAs = headAs;
  _tailIp = tailIp;
  _headIp = headIp;
  _sessionType = sessionType;
  _confedSessionType = confedType;
}
 
源代码3 项目: plugins   文件: HotColdSolverTest.java
@Test
public void testOneStepSolution()
{
	final Set<HotColdLocation> foundLocation = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE);

	testSolver(createHotColdSolver(), new WorldPoint(2852, 2992, 0), RESPONSE_TEXT_VERY_HOT, foundLocation);
}
 
源代码4 项目: geowave   文件: HBaseUtils.java
public static ImmutableSet<ServerOpScope> stringToScopes(final String value) {
  final String[] scopes = value.split(",");
  return Sets.immutableEnumSet(
      Iterables.transform(Arrays.asList(scopes), new Function<String, ServerOpScope>() {

        @Override
        public ServerOpScope apply(final String input) {
          return ServerOpScope.valueOf(input);
        }
      }));
}
 
源代码5 项目: plugins   文件: HotColdSolverTest.java
@Test
public void testSameTempNoChanges()
{
	final HotColdSolver solver = createHotColdSolver();
	final WorldPoint testedPoint = new WorldPoint(2851, 2955, 0);
	final Set<HotColdLocation> foundLocations = Sets.immutableEnumSet(
		HotColdLocation.KARAMJA_KHARAZI_NE,
		HotColdLocation.KARAMJA_KHARAZI_SW);

	testSolver(solver, testedPoint, RESPONSE_TEXT_VERY_HOT, foundLocations);
	testSolver(solver, testedPoint, RESPONSE_TEXT_VERY_HOT_SAME_TEMP, foundLocations);
}
 
源代码6 项目: calcite   文件: RexSimplify.java
SafeRexVisitor() {
  Set<SqlKind> safeOps = EnumSet.noneOf(SqlKind.class);

  safeOps.addAll(SqlKind.COMPARISON);
  safeOps.add(SqlKind.PLUS_PREFIX);
  safeOps.add(SqlKind.MINUS_PREFIX);
  safeOps.add(SqlKind.PLUS);
  safeOps.add(SqlKind.MINUS);
  safeOps.add(SqlKind.TIMES);
  safeOps.add(SqlKind.IS_FALSE);
  safeOps.add(SqlKind.IS_NOT_FALSE);
  safeOps.add(SqlKind.IS_TRUE);
  safeOps.add(SqlKind.IS_NOT_TRUE);
  safeOps.add(SqlKind.IS_NULL);
  safeOps.add(SqlKind.IS_NOT_NULL);
  safeOps.add(SqlKind.IS_DISTINCT_FROM);
  safeOps.add(SqlKind.IS_NOT_DISTINCT_FROM);
  safeOps.add(SqlKind.IN);
  safeOps.add(SqlKind.NOT_IN);
  safeOps.add(SqlKind.OR);
  safeOps.add(SqlKind.AND);
  safeOps.add(SqlKind.NOT);
  safeOps.add(SqlKind.CASE);
  safeOps.add(SqlKind.LIKE);
  safeOps.add(SqlKind.COALESCE);
  safeOps.add(SqlKind.TRIM);
  safeOps.add(SqlKind.LTRIM);
  safeOps.add(SqlKind.RTRIM);
  safeOps.add(SqlKind.BETWEEN);
  safeOps.add(SqlKind.CEIL);
  safeOps.add(SqlKind.FLOOR);
  safeOps.add(SqlKind.REVERSE);
  safeOps.add(SqlKind.TIMESTAMP_ADD);
  safeOps.add(SqlKind.TIMESTAMP_DIFF);
  this.safeOps = Sets.immutableEnumSet(safeOps);
}
 
源代码7 项目: plugins   文件: HotColdSolverTest.java
@Test
public void testNarrowToFindSolutions()
{
	final HotColdSolver solver = createHotColdSolver();
	final Set<HotColdLocation> firstLocationsSet = Sets.immutableEnumSet(
		HotColdLocation.FELDIP_HILLS_GNOME_GLITER,
		HotColdLocation.FELDIP_HILLS_RANTZ,
		HotColdLocation.FELDIP_HILLS_RED_CHIN,
		HotColdLocation.KARAMJA_KHARAZI_NE,
		HotColdLocation.KARAMJA_CRASH_ISLAND);
	final Set<HotColdLocation> secondLocationsSet = firstLocationsSet.stream()
		.filter(location -> location != HotColdLocation.FELDIP_HILLS_GNOME_GLITER
			&& location != HotColdLocation.FELDIP_HILLS_RANTZ)
		.collect(Collectors.toSet());
	final Set<HotColdLocation> thirdLocationSet = secondLocationsSet.stream()
		.filter(location -> location != HotColdLocation.FELDIP_HILLS_RED_CHIN)
		.collect(Collectors.toSet());
	final Set<HotColdLocation> finalLocation = thirdLocationSet.stream()
		.filter(location -> location != HotColdLocation.KARAMJA_CRASH_ISLAND)
		.collect(Collectors.toSet());

	testSolver(solver, new WorldPoint(2711, 2803, 0), RESPONSE_TEXT_COLD, firstLocationsSet);
	testSolver(solver, new WorldPoint(2711, 2802, 0), RESPONSE_TEXT_COLD_SAME_TEMP, secondLocationsSet);
	testSolver(solver, new WorldPoint(2716, 2802, 0), RESPONSE_TEXT_COLD_WARMER, thirdLocationSet);
	testSolver(solver, new WorldPoint(2739, 2808, 0), RESPONSE_TEXT_COLD_WARMER, thirdLocationSet);
	testSolver(solver, new WorldPoint(2810, 2757, 0), RESPONSE_TEXT_COLD_COLDER, finalLocation);
}
 
源代码8 项目: centraldogma   文件: PerRolePermissions.java
/**
 * Creates an instance.
 */
@JsonCreator
public PerRolePermissions(@JsonProperty("owner") Iterable<Permission> owner,
                          @JsonProperty("member") Iterable<Permission> member,
                          @JsonProperty("guest") Iterable<Permission> guest) {
    this.owner = Sets.immutableEnumSet(requireNonNull(owner, "owner"));
    this.member = Sets.immutableEnumSet(requireNonNull(member, "member"));
    this.guest = Sets.immutableEnumSet(requireNonNull(guest, "guest"));
}
 
源代码9 项目: armeria   文件: RetryRule.java
/**
 * Returns a newly created {@link RetryRuleBuilder} with the specified {@link HttpMethod}s.
 */
static RetryRuleBuilder builder(Iterable<HttpMethod> methods) {
    requireNonNull(methods, "methods");
    checkArgument(!Iterables.isEmpty(methods), "method can't be empty.");
    final ImmutableSet<HttpMethod> httpMethods = Sets.immutableEnumSet(methods);
    return builder(headers -> httpMethods.contains(headers.method()));
}
 
源代码10 项目: armeria   文件: RetryRuleWithContent.java
/**
 * Returns a newly created {@link RetryRuleWithContentBuilder} with the specified {@link HttpMethod}s.
 */
static <T extends Response> RetryRuleWithContentBuilder<T> builder(Iterable<HttpMethod> methods) {
    requireNonNull(methods, "methods");
    checkArgument(!Iterables.isEmpty(methods), "methods can't be empty.");
    final ImmutableSet<HttpMethod> httpMethods = Sets.immutableEnumSet(methods);
    return builder(headers -> httpMethods.contains(headers.method()));
}
 
源代码11 项目: runelite   文件: HotColdSolverTest.java
@Test
public void testNarrowToFindSolutions()
{
	final HotColdSolver solver = createHotColdSolver();
	final Set<HotColdLocation> firstLocationsSet = Sets.immutableEnumSet(
		HotColdLocation.FELDIP_HILLS_GNOME_GLITER,
		HotColdLocation.FELDIP_HILLS_RANTZ,
		HotColdLocation.FELDIP_HILLS_RED_CHIN,
		HotColdLocation.KARAMJA_KHARAZI_NE,
		HotColdLocation.KARAMJA_CRASH_ISLAND);
	final Set<HotColdLocation> secondLocationsSet = firstLocationsSet.stream()
		.filter(location -> location != HotColdLocation.FELDIP_HILLS_GNOME_GLITER
			&& location != HotColdLocation.FELDIP_HILLS_RANTZ)
		.collect(Collectors.toSet());
	final Set<HotColdLocation> thirdLocationSet = secondLocationsSet.stream()
		.filter(location -> location != HotColdLocation.FELDIP_HILLS_RED_CHIN)
		.collect(Collectors.toSet());
	final Set<HotColdLocation> finalLocation = thirdLocationSet.stream()
		.filter(location -> location != HotColdLocation.KARAMJA_CRASH_ISLAND)
		.collect(Collectors.toSet());

	testSolver(solver, new WorldPoint(2711, 2803, 0), RESPONSE_TEXT_COLD, firstLocationsSet);
	testSolver(solver, new WorldPoint(2711, 2802, 0), RESPONSE_TEXT_COLD_SAME_TEMP, secondLocationsSet);
	testSolver(solver, new WorldPoint(2716, 2802, 0), RESPONSE_TEXT_COLD_WARMER, thirdLocationSet);
	testSolver(solver, new WorldPoint(2739, 2808, 0), RESPONSE_TEXT_COLD_WARMER, thirdLocationSet);
	testSolver(solver, new WorldPoint(2810, 2757, 0), RESPONSE_TEXT_COLD_COLDER, finalLocation);
}
 
源代码12 项目: runelite   文件: HotColdSolverTest.java
@Test
public void testOneStepSolution()
{
	final Set<HotColdLocation> foundLocation = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE);

	testSolver(createHotColdSolver(), new WorldPoint(2852, 2992, 0), RESPONSE_TEXT_VERY_HOT, foundLocation);
}
 
源代码13 项目: compile-testing   文件: Compilation.java
ImmutableList<Diagnostic<? extends JavaFileObject>> diagnosticsOfKind(Kind kind, Kind... more) {
  ImmutableSet<Kind> kinds = Sets.immutableEnumSet(kind, more);
  return diagnostics()
      .stream()
      .filter(diagnostic -> kinds.contains(diagnostic.getKind()))
      .collect(toImmutableList());
}
 
源代码14 项目: caffeine   文件: CambridgeTraceReader.java
@Override
public Set<Characteristic> characteristics() {
  return Sets.immutableEnumSet(WEIGHTED);
}
 
源代码15 项目: shrinker   文件: InlineRTransform.java
@Override
public Set<? super QualifiedContent.Scope> getReferencedScopes() {
    if (config.inlineR) // empty
        return ImmutableSet.of();
    return Sets.immutableEnumSet(QualifiedContent.Scope.PROJECT);
}
 
@NonNull
@Override
public Set<QualifiedContent.Scope> getReferencedScopes() {
    return Sets.immutableEnumSet(QualifiedContent.Scope.SUB_PROJECTS,
            QualifiedContent.Scope.EXTERNAL_LIBRARIES);
}
 
源代码17 项目: jimfs   文件: PosixAttributeProvider.java
@SuppressWarnings("unchecked")
@Override
public ImmutableMap<String, ?> defaultValues(Map<String, ?> userProvidedDefaults) {
  Object userProvidedGroup = userProvidedDefaults.get("posix:group");

  UserPrincipal group = DEFAULT_GROUP;
  if (userProvidedGroup != null) {
    if (userProvidedGroup instanceof String) {
      group = createGroupPrincipal((String) userProvidedGroup);
    } else {
      throw new IllegalArgumentException(
          "invalid type "
              + userProvidedGroup.getClass().getName()
              + " for attribute 'posix:group': should be one of "
              + String.class
              + " or "
              + GroupPrincipal.class);
    }
  }

  Object userProvidedPermissions = userProvidedDefaults.get("posix:permissions");

  Set<PosixFilePermission> permissions = DEFAULT_PERMISSIONS;
  if (userProvidedPermissions != null) {
    if (userProvidedPermissions instanceof String) {
      permissions =
          Sets.immutableEnumSet(
              PosixFilePermissions.fromString((String) userProvidedPermissions));
    } else if (userProvidedPermissions instanceof Set) {
      permissions = toPermissions((Set<?>) userProvidedPermissions);
    } else {
      throw new IllegalArgumentException(
          "invalid type "
              + userProvidedPermissions.getClass().getName()
              + " for attribute 'posix:permissions': should be one of "
              + String.class
              + " or "
              + Set.class);
    }
  }

  return ImmutableMap.of(
      "posix:group", group,
      "posix:permissions", permissions);
}
 
源代码18 项目: dremio-oss   文件: UserClient.java
@Override
  protected void validateHandshake(BitToUserHandshake inbound) throws RpcException {
//    logger.debug("Handling handshake from bit to user. {}", inbound);
    if (inbound.getStatus() != HandshakeStatus.SUCCESS) {
      final String errMsg = String.format("Status: %s, Error Id: %s, Error message: %s",
          inbound.getStatus(), inbound.getErrorId(), inbound.getErrorMessage());
      logger.error(errMsg);
      throw new RpcException(errMsg, inbound.getStatus().toString(), inbound.getErrorId());
    }

    // Successful connection...
    if (inbound.hasServerInfos()) {
      serverInfos = inbound.getServerInfos();
    }
    supportedMethods = Sets.immutableEnumSet(inbound.getSupportedMethodsList());
    // Older servers don't return record batch format: assume pre-1.4 servers
    RecordBatchFormat recordBatchFormat = inbound.hasRecordBatchFormat() ? inbound.getRecordBatchFormat() : RecordBatchFormat.DREMIO_0_9;

    switch(recordBatchFormat) {
    case DREMIO_1_4:
      break;

    case DREMIO_0_9:
    {
      /*
       * From Dremio 1.4 onwards we have moved to Little Endian Decimal format. We need to
       * add a new decoder in the netty pipeline when talking to old (1.3 and less) Dremio
       * servers.
       */
      final BufferAllocator bcAllocator = connection.getAllocator()
          .newChildAllocator("dremio09-backward", 0, Long.MAX_VALUE);
      logger.debug("Adding dremio 09 backwards compatibility decoder");
      connection.getChannel()
        .pipeline()
        .addAfter(PROTOCOL_DECODER, UserRpcUtils.DREMIO09_COMPATIBILITY_ENCODER,
          new BackwardsCompatibilityDecoder(bcAllocator, new Dremio09BackwardCompatibilityHandler(bcAllocator)));
      }
      break;

    case UNKNOWN:
    default:
      throw new RpcException("Unsupported record batch format: " + recordBatchFormat);
    }
  }
 
private DocumentFieldDescriptor(final Builder builder)
{
	fieldName = Preconditions.checkNotNull(builder.fieldName, "name is null");
	caption = builder.getCaption();
	description = builder.getDescription();
	detailId = builder.getDetailId();

	key = builder.isKey();
	calculated = builder.isCalculated();

	parentLink = builder.parentLink;
	parentLinkFieldName = builder.parentLinkFieldName;

	widgetType = builder.getWidgetType();
	fieldMaxLength = builder.getFieldMaxLength();

	widgetSize = builder.getWidgetSize();
	allowShowPassword = builder.isAllowShowPassword();
	buttonActionDescriptor = builder.getButtonActionDescriptor();
	barcodeScannerType = builder.getBarcodeScannerType();
	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;
}
 
源代码20 项目: Strata   文件: ImmutableHolidayCalendar.java
/**
 * Obtains an instance from a set of holiday dates and weekend days.
 * <p>
 * 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 of(id, ImmutableSortedSet.copyOf(holidays), weekendDays, ImmutableSet.of());
}