Search in sources :

Example 36 with Nonnull

use of javax.annotation.Nonnull in project neo4j by neo4j.

the class HttpConnectorValidator method getSettingFor.

@Override
@Nonnull
protected Optional<Setting<Object>> getSettingFor(@Nonnull String settingName, @Nonnull Map<String, String> params) {
    // owns has already verified that 'type' is correct and that this split is possible
    String[] parts = settingName.split("\\.");
    final String name = parts[2];
    final String subsetting = parts[3];
    final boolean encrypted = encryptionSetting(name).apply(params::get).equals(Encryption.TLS);
    BaseSetting setting;
    switch(subsetting) {
        case "enabled":
            setting = setting(settingName, BOOLEAN, "false");
            setting.setDescription("Enable this connector.");
            break;
        case "type":
            setting = setting(settingName, options(Connector.ConnectorType.class), NO_DEFAULT);
            setting.setDeprecated(true);
            setting.setDescription("Connector type. This setting is deprecated and its value will instead be " + "inferred from the name of the connector.");
            break;
        case "encryption":
            setting = encryptionSetting(name);
            setting.setDescription("Enable TLS for this connector.");
            break;
        case "address":
            setting = listenAddress(settingName, defaultPort(name, params));
            setting.setDeprecated(true);
            setting.setReplacement("dbms.connector." + name + ".listen_address");
            setting.setDescription("Address the connector should bind to. Deprecated and replaced by " + setting.replacement().get() + ".");
            break;
        case "listen_address":
            setting = listenAddress(settingName, defaultPort(name, params));
            setting.setDescription("Address the connector should bind to.");
            break;
        case "advertised_address":
            setting = advertisedAddress(settingName, listenAddress(settingName, defaultPort(name, params)));
            setting.setDescription("Advertised address for this connector.");
            break;
        default:
            return Optional.empty();
    }
    // If not deprecated for other reasons
    if (isDeprecatedConnectorName(name) && !setting.deprecated()) {
        setting.setDeprecated(true);
        setting.setReplacement(format("%s.%s.%s.%s", parts[0], parts[1], encrypted ? "https" : "http", subsetting));
    }
    return Optional.of(setting);
}
Also used : BaseSetting(org.neo4j.graphdb.config.BaseSetting) Nonnull(javax.annotation.Nonnull)

Example 37 with Nonnull

use of javax.annotation.Nonnull in project neo4j by neo4j.

the class HaConfigurationValidator method validate.

@Override
@Nonnull
public Map<String, String> validate(@Nonnull Collection<SettingValidator> settingValidators, @Nonnull Map<String, String> rawConfig, @Nonnull Log log, boolean parsingFile) throws InvalidSettingException {
    // Make sure mode is HA
    Mode mode = ClusterSettings.mode.apply(rawConfig::get);
    if (!mode.equals(Mode.HA) && !mode.equals(Mode.ARBITER)) {
        // Nothing to validate
        return rawConfig;
    }
    validateServerId(rawConfig::get);
    validateInitialHosts(rawConfig::get);
    return rawConfig;
}
Also used : Mode(org.neo4j.cluster.ClusterSettings.Mode) Nonnull(javax.annotation.Nonnull)

Example 38 with Nonnull

use of javax.annotation.Nonnull in project Realistic-Terrain-Generation by Team-RTG.

the class WorldTypeRTG method getChunkGenerator.

@Override
@Nonnull
public IChunkGenerator getChunkGenerator(@Nonnull World world, String generatorOptions) {
    if (DimensionManagerRTG.isValidDimension(world.provider.getDimension())) {
        //if (chunkProvider == null) {
        chunkProvider = new ChunkProviderRTG(world, world.getSeed());
        RTG.instance.runOnNextServerCloseOnly(clearProvider(chunkProvider));
        // inform the event manager about the ChunkEvent.Load event
        RTG.eventMgr.setDimensionChunkLoadEvent(world.provider.getDimension(), chunkProvider.delayedDecorator);
        RTG.instance.runOnNextServerCloseOnly(chunkProvider.clearOnServerClose());
        Logger.debug("WorldTypeRTG#getChunkGenerator() returning ChunkProviderRTG");
        return chunkProvider;
    //}
    // return a "fake" provider that won't decorate for Streams
    //ChunkProviderRTG result = new ChunkProviderRTG(world, world.getSeed());
    //result.isFakeGenerator();
    //return result;
    // no server close because it's not supposed to decorate
    //return chunkProvider;
    } else {
        Logger.debug("Invalid dimension. Serving up ChunkProviderOverworld instead of ChunkProviderRTG.");
        return new ChunkProviderOverworld(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled(), generatorOptions);
    }
}
Also used : ChunkProviderRTG(rtg.world.gen.ChunkProviderRTG) ChunkProviderOverworld(net.minecraft.world.gen.ChunkProviderOverworld) Nonnull(javax.annotation.Nonnull)

Example 39 with Nonnull

use of javax.annotation.Nonnull in project Realistic-Terrain-Generation by Team-RTG.

the class WorldTypeRTG method getBiomeProvider.

@Override
@Nonnull
public BiomeProvider getBiomeProvider(@Nonnull World world) {
    if (DimensionManagerRTG.isValidDimension(world.provider.getDimension())) {
        if (biomeProvider == null) {
            biomeProvider = new BiomeProviderRTG(world, this);
            RTG.instance.runOnNextServerCloseOnly(clearProvider(biomeProvider));
        }
        Logger.debug("WorldTypeRTG#getBiomeProvider() returning BiomeProviderRTG");
        return biomeProvider;
    } else {
        Logger.debug("WorldTypeRTG#getBiomeProvider() returning vanilla BiomeProvider");
        return new BiomeProvider(world.getWorldInfo());
    }
}
Also used : BiomeProvider(net.minecraft.world.biome.BiomeProvider) BiomeProviderRTG(rtg.world.biome.BiomeProviderRTG) Nonnull(javax.annotation.Nonnull)

Example 40 with Nonnull

use of javax.annotation.Nonnull in project Railcraft by Railcraft.

the class ItemHandlerInventoryManipulator method removeItem.

@Nonnull
@Override
protected List<ItemStack> removeItem(Predicate<ItemStack> filter, int maxAmount, boolean doRemove) {
    int amountNeeded = maxAmount;
    List<ItemStack> outputList = new ArrayList<ItemStack>();
    for (IInvSlot slot : this) {
        if (amountNeeded <= 0)
            break;
        ItemStack stack = slot.getStack();
        if (!isEmpty(stack) && slot.canTakeStackFromSlot(stack) && filter.test(stack)) {
            ItemStack removed = inv.extractItem(slot.getIndex(), amountNeeded, !doRemove);
            if (!isEmpty(removed)) {
                amountNeeded -= removed.stackSize;
                outputList.add(removed);
            }
        }
    }
    return outputList;
}
Also used : IInvSlot(mods.railcraft.common.util.inventory.iterators.IInvSlot) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)2624 Nullable (javax.annotation.Nullable)338 ArrayList (java.util.ArrayList)336 ItemStack (net.minecraft.item.ItemStack)327 List (java.util.List)305 Map (java.util.Map)229 Layer (com.simiacryptus.mindseye.lang.Layer)188 Tensor (com.simiacryptus.mindseye.lang.Tensor)185 Arrays (java.util.Arrays)182 Collectors (java.util.stream.Collectors)169 IOException (java.io.IOException)165 JsonObject (com.google.gson.JsonObject)156 HashMap (java.util.HashMap)145 IntStream (java.util.stream.IntStream)145 Test (org.junit.Test)143 LoggerFactory (org.slf4j.LoggerFactory)138 Logger (org.slf4j.Logger)137 Result (com.simiacryptus.mindseye.lang.Result)130 TensorList (com.simiacryptus.mindseye.lang.TensorList)123 DeltaSet (com.simiacryptus.mindseye.lang.DeltaSet)111