com.google.common.base.Function源码实例Demo

类com.google.common.base.Function源码实例Demo

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

源代码1 项目: bistoury   文件: SQLiteStoreImpl.java
private static String getDeleteSql(List<String> keys) {
    List<String> newKeys = Lists.transform(keys, new Function<String, String>() {
        @Override
        public String apply(String input) {
            return "'" + input + "'";
        }
    });
    StringBuilder sb = new StringBuilder("delete from bistoury where b_key in (");

    Joiner joiner = Joiner.on(",").skipNulls();

    HashSet<String> set = Sets.newHashSet(newKeys);
    if (set.size() == 0) {
        return null;
    }

    joiner.appendTo(sb, set);
    sb.append(")");
    return sb.toString();
}
 
源代码2 项目: arcusplatform   文件: I18NServiceImpl.java
@Override
public ClientFuture<LoadLocalizedStringsResponse> loadLocalizedStrings(Set<String> strings, String s) {
 ClientRequest request = new ClientRequest();
 Map<String, Object> elements = new HashMap<>();
 elements.put("bundleNames", strings);
 elements.put("locale", s);
 request.setAttributes(elements);
 request.setTimeoutMs(10000);
 request.setAddress(getAddress());
 request.setCommand(I18NService.CMD_LOADLOCALIZEDSTRINGS);
 request.setConnectionURL(client.getConnectionURL());
 request.setRestfulRequest(true);

    return Futures.transform(client.request(request), new Function<ClientEvent, LoadLocalizedStringsResponse>() {
        @Override
        public LoadLocalizedStringsResponse apply(ClientEvent input) {
            return (new LoadLocalizedStringsResponse(input));
        }
    });
}
 
源代码3 项目: arcusplatform   文件: ProductCatalogServiceImpl.java
@Override
public ClientFuture<GetProductCatalogResponse> getProductCatalog(String place) {
	GetProductCatalogRequest request = new GetProductCatalogRequest();
	request.setAddress(getAddress());
	request.setRestfulRequest(true);
	request.setPlace(place);

	ClientFuture<ClientEvent> result = client.request(request);

	return Futures.transform(result, new Function<ClientEvent, GetProductCatalogResponse>() {
		@Override
		public GetProductCatalogResponse apply(ClientEvent input) {
			GetProductCatalogResponse response = new GetProductCatalogResponse(input);
			return response;
		}
	});
}
 
@Override
public Iterator<GTRecord> iterator() {
    Iterator<PartitionResultIterator> iterators = Iterators.transform(blocks,
            new Function<byte[], PartitionResultIterator>() {
                public PartitionResultIterator apply(byte[] input) {
                    return new PartitionResultIterator(input, info, columns);
                }
            });

    if (!needSorted) {
        logger.debug("Using Iterators.concat to pipeline partition results");
        return Iterators.concat(iterators);
    }

    return new SortMergedPartitionResultIterator(iterators, info, GTRecord.getComparator(groupByDims));
}
 
源代码5 项目: ghidra   文件: GraphViewerUtils.java
/**
 * Returns a rectangle that contains all give vertices
 * 
 * @param viewer the viewer containing the UI
 * @param vertices the vertices 
 * @return a rectangle that contains all give vertices
 */
public static <V, E> Rectangle getBoundsForVerticesInLayoutSpace(
		VisualizationServer<V, E> viewer, Collection<V> vertices) {

	Layout<V, E> layout = viewer.getGraphLayout();
	RenderContext<V, E> renderContext = viewer.getRenderContext();
	Function<? super V, Shape> shapeTransformer = renderContext.getVertexShapeTransformer();

	Function<V, Rectangle> transformer = v -> {

		Shape shape = shapeTransformer.apply(v);
		Rectangle bounds = shape.getBounds();
		Point2D point = layout.apply(v);
		bounds.setLocation(new Point((int) point.getX(), (int) point.getY()));
		return bounds;
	};
	return getBoundsForVerticesInLayoutSpace(vertices, transformer);
}
 
源代码6 项目: arcusplatform   文件: RuleServiceImpl.java
@Override
public ClientFuture<GetRuleTemplatesByCategoryResponse> getRuleTemplatesByCategory(String placeId, String category) {
   ClientRequest request = buildRequest(
         RuleService.CMD_GETRULETEMPLATESBYCATEGORY,
         ImmutableMap.<String,Object>of(GetRuleTemplatesByCategoryRequest.ATTR_PLACEID, placeId,
                                        GetRuleTemplatesByCategoryRequest.ATTR_CATEGORY, category));
   ClientFuture<ClientEvent> result = client.request(request);
   return Futures.transform(result, new Function<ClientEvent, GetRuleTemplatesByCategoryResponse>() {
      @Override
      public GetRuleTemplatesByCategoryResponse apply(ClientEvent input) {
         GetRuleTemplatesByCategoryResponse response = new GetRuleTemplatesByCategoryResponse(input);
         IrisClientFactory.getModelCache().addOrUpdate(response.getRuleTemplates());
         return response;
      }
   });
}
 
源代码7 项目: arcusplatform   文件: Main.java
private static Predicate<Entry> or(List<String> queries, Function<String, Predicate<Entry>> transform) {
   Preconditions.checkNotNull(transform);
   if(queries == null || queries.isEmpty()) {
      return Predicates.alwaysTrue();
   }
   List<Predicate<Entry>> predicates = new ArrayList<>(queries.size());
   for(String query: queries) {
      Predicate<Entry> p = transform.apply(query);
      if(p != null) {
         predicates.add(p);
      }
   }
   if(predicates.isEmpty()) {
      return Predicates.alwaysTrue();
   }
   else if(predicates.size() == 1) {
      return predicates.get(0);
   }
   else {
      return Predicates.or(predicates);
   }
}
 
源代码8 项目: arcusplatform   文件: SessionServiceImpl.java
@Override
public ClientFuture<LockDeviceResponse> lockDevice(String deviceIdentifier, String reason) {
	LockDeviceRequest request = new LockDeviceRequest();
     request.setAddress(getAddress());
     request.setRestfulRequest(true);
     request.setDeviceIdentifier(deviceIdentifier);
     request.setReason(reason);

     ClientFuture<ClientEvent> result = client.request(request);
     return Futures.transform(result, new Function<ClientEvent, LockDeviceResponse>() {
        @Override
        public LockDeviceResponse apply(ClientEvent response) {
           return new LockDeviceResponse(response);
        }
     });
}
 
源代码9 项目: arcusplatform   文件: RuleServiceImpl.java
@Override
public ClientFuture<ListRuleTemplatesResponse> listRuleTemplates(String placeId) {
   ClientRequest request = buildRequest(
         RuleService.CMD_LISTRULETEMPLATES,
         ImmutableMap.<String, Object>of(ListRuleTemplatesRequest.ATTR_PLACEID, placeId)
   );
   ClientFuture<ClientEvent> result = client.request(request);
   return Futures.transform(result, new Function<ClientEvent, ListRuleTemplatesResponse>() {
      @Override
      public ListRuleTemplatesResponse apply(ClientEvent input) {
         ListRuleTemplatesResponse response = new ListRuleTemplatesResponse(input);
         IrisClientFactory.getModelCache().retainAll(RuleTemplate.NAMESPACE, response.getRuleTemplates());
         return response;
      }

   });
}
 
源代码10 项目: sharding-jdbc-1.5.1   文件: YamlIntegratedTest.java
@Test
public void testWithDataSource() throws SQLException, URISyntaxException, IOException {
    File yamlFile = new File(YamlIntegratedTest.class.getResource(filePath).toURI());
    DataSource dataSource;
    if (hasDataSource) {
        dataSource = new YamlShardingDataSource(yamlFile);
    } else {
        dataSource = new YamlShardingDataSource(Maps.asMap(Sets.newHashSet("db0", "db1"), new Function<String, DataSource>() {
            @Override
            public DataSource apply(final String key) {
                return createDataSource(key);
            }
        }), yamlFile);
    }
    
    try (Connection conn = dataSource.getConnection();
         Statement stm = conn.createStatement()) {
        stm.executeQuery("SELECT * FROM t_order");
        stm.executeQuery("SELECT * FROM t_order_item");
        stm.executeQuery("SELECT * FROM config");
    }
}
 
源代码11 项目: arcusplatform   文件: SessionServiceImpl.java
@Override
public ClientFuture<LogResponse> log(String category, String code, String message) {
   LogRequest request = new LogRequest();
   request.setAddress(getAddress());
   request.setRestfulRequest(false);

   request.setCategory(category);
   request.setCode(code);
   request.setMessage(message);

   ClientFuture<ClientEvent> result = client.request(request);
   return Futures.transform(result, new Function<ClientEvent, LogResponse>() {
      @Override
      public LogResponse apply(ClientEvent input) {
         return new LogResponse(input);
      }
   });
}
 
源代码12 项目: qconfig   文件: NotifyServiceImpl.java
@Override
public void notifyPushIp(final ConfigMeta meta, final long version, List<Host> destinations) {
    List<String> serverUrls = getServerUrls();
    if (serverUrls.isEmpty()) {
        logger.warn("notify push server, {}, version: {}, but no server, {}", meta, version, destinations);
        return;
    }

    String uri = this.notifyIpPushUrl;
    logger.info("notify push server, {}, version: {}, uri: {}, servers: {}, {}", meta, version, uri, serverUrls, destinations);
    StringBuilder sb = new StringBuilder();
    for (Host item : destinations) {
        sb.append(item.getIp()).append(Constants.LINE);
    }
    final String destinationsStr = sb.toString();

    doNotify(serverUrls, uri, "admin/notifyIpPush", new Function<String, Request>() {
        @Override
        public Request apply(String url) {
            AsyncHttpClient.BoundRequestBuilder builder = getBoundRequestBuilder(url, meta, version, destinationsStr);
            return builder.build();
        }
    });
}
 
源代码13 项目: arcusplatform   文件: SchedulerServiceImpl.java
@Override
public ClientFuture<ScheduleCommandsResponse> scheduleCommands(
      String target, String group, List<Map<String, Object>> commands) {
   ScheduleCommandsRequest request = new ScheduleCommandsRequest();
   request.setAddress(getAddress());
   request.setTarget(target);
   request.setGroup(group);
   request.setCommands(commands);
   
   ClientFuture<ClientEvent> result = client.request(request);
   return Futures.transform(result, new Function<ClientEvent, ScheduleCommandsResponse>() {
      @Override
      public ScheduleCommandsResponse apply(ClientEvent response) {
         return new ScheduleCommandsResponse(response);
      }
   });
}
 
源代码14 项目: arcusplatform   文件: EventResolverFactory.java
@Override
public Function<? super SubsystemEventAndContext, ?> getResolverForParameter(Method method, Type parameter, Annotation[] annotations) {
   if(parameter instanceof Class) {
      Class<?> type = (Class<?>) parameter;
      if(type.isAssignableFrom(eventType)) {
         return GetEvent;
      }
      if(type.isAssignableFrom(Address.class)) {
         return GetAddress;
      }
      if(type.equals(Model.class)) {
         return GetModel;
      }
   }
   else if(parameter instanceof ParameterizedType) {
      return getResolverForParameter(method, ((ParameterizedType) parameter).getRawType(), annotations);
   }
   return super.getResolverForParameter(method, parameter, annotations);
}
 
private static AemContext createContext(String contentPath) {
    return new AemContext(
        (AemContextCallback) context -> {
            // Load page structure
            context.load().json(contentPath, "/content");

            UrlProviderImpl urlProvider = new UrlProviderImpl();
            urlProvider.activate(new MockUrlProviderConfiguration());
            context.registerService(UrlProvider.class, urlProvider);

            context.registerInjectActivateService(new SearchFilterServiceImpl());
            context.registerInjectActivateService(new SearchResultsServiceImpl());
            context.registerAdapter(Resource.class, ComponentsConfiguration.class,
                (Function<Resource, ComponentsConfiguration>) input -> MOCK_CONFIGURATION_OBJECT);
        },
        ResourceResolverType.JCR_MOCK);
}
 
源代码16 项目: arcusplatform   文件: RegexDfaByte.java
public <T> RegexDfaByte<T> transform(Function<V,T> transformer) {
   IdentityHashMap<State<V>,State<T>> stateMap = new IdentityHashMap<>();

   State<T> newInitialState = null;
   for (State<V> state : states) {
      State<T> transformed = state.transform(transformer);
      if (transformed.isInitialState()) {
         newInitialState = transformed;
      }

      stateMap.put(state, transformed);
   }

   for (Map.Entry<State<V>,State<T>> entry : stateMap.entrySet()) {
      State<V> oldState = entry.getKey();
      State<T> newState = entry.getValue();
      newState.setTransitions(oldState.getTransitions().transform(stateMap,transformer));
   }

   if (newInitialState == null) {
      throw new IllegalStateException("no initial state");
   }

   Set<State<T>> newStates = ImmutableSet.copyOf(stateMap.values());
   return new RegexDfaByte<T>(newInitialState, newStates);
}
 
源代码17 项目: arcusplatform   文件: RuleTemplateRequestor.java
public ListenableFuture<List<Map<String, Object>>> listTemplatesForPlace(UUID placeId) {
	MessageBody listTemplates =
		ListRuleTemplatesRequest
			.builder()
			.withPlaceId(placeId.toString())
			.build();
	PlatformMessage request =
		PlatformMessage
			.request(RuleService.ADDRESS)
			.from(PairingDeviceService.ADDRESS)
			.withCorrelationId(IrisUUID.randomUUID().toString())
			.withPlaceId(placeId)
			.withPopulation(populationCacheMgr.getPopulationByPlaceId(placeId))
			.withPayload(listTemplates)
			.create();
	return 
		Futures.transform(
			requestor.request(request), 
			(Function<PlatformMessage, List<Map<String, Object>>>) (message) -> ListRuleTemplatesResponse.getRuleTemplates(message.getValue(), ImmutableList.of()),
			MoreExecutors.directExecutor()
		);
}
 
源代码18 项目: arcusplatform   文件: SessionServiceImpl.java
@Override
public ClientFuture<SetActivePlaceResponse> setActivePlace(String placeId) {
   SetActivePlaceRequest request = new SetActivePlaceRequest();
   request.setAddress(getAddress());
   request.setRestfulRequest(false);

   request.setPlaceId(placeId);

   ClientFuture<ClientEvent> result = client.request(request);
   return Futures.transform(result, new Function<ClientEvent, SetActivePlaceResponse>() {
      @Override
      public SetActivePlaceResponse apply(ClientEvent input) {
         return new SetActivePlaceResponse(input);
      }
   });
}
 
源代码19 项目: arcusplatform   文件: HubAlarmSubsystem.java
@Request(SubsystemCapability.SuspendRequest.NAME)
public void suspend(final SubsystemContext<AlarmSubsystemModel> context, PlatformMessage request) {
   if(!AlarmUtil.isActive(context)) {
      return;
   }

   assertValidSuspendState(context);

   AlarmUtil.sendHubRequest(context, request, HubAlarmCapability.SuspendRequest.instance(),
      new Function<PlatformMessage, MessageBody>() {
         @Override
         public MessageBody apply(PlatformMessage input) {
            context.model().setState(SubsystemCapability.STATE_SUSPENDED);
            context.model().setAvailable(false);
            return SubsystemCapability.SuspendResponse.instance();
         }
      }
   );
}
 
private static AemContext createContext(String contentPath) {
    return new AemContext(
        (AemContextCallback) context -> {
            // Load page structure
            context.load().json(contentPath, "/content");
            context.registerService(ImplementationPicker.class, new ResourceTypeImplementationPicker());

            UrlProviderImpl urlProvider = new UrlProviderImpl();
            urlProvider.activate(new MockUrlProviderConfiguration());
            context.registerService(UrlProvider.class, urlProvider);

            context.registerInjectActivateService(new SearchFilterServiceImpl());
            context.registerInjectActivateService(new SearchResultsServiceImpl());
            context.registerAdapter(Resource.class, ComponentsConfiguration.class,
                (Function<Resource, ComponentsConfiguration>) input -> MOCK_CONFIGURATION_OBJECT);
        },
        ResourceResolverType.JCR_MOCK);
}
 
源代码21 项目: arcusplatform   文件: AnnotatedSubsystem.java
protected final void handleRequest(MessageReceivedEvent event, SubsystemContext<M> context) {
   PlatformMessage request = event.getMessage();
   String type = request.getMessageType();
   Function<SubsystemEventAndContext, MessageBody> handler = requestHandlers.get(type);
   if(handler == null) {
      context.sendResponse(request, Errors.invalidRequest(type));
   }
   else {
      MessageBody response;
      try {
         response = handler.apply(new SubsystemEventAndContext(context, event));
      }
      catch(Exception e) {
         context.logger().warn("Error handling request {}", request, e);
         response = Errors.fromException(e);
      }
      if(response != null) {
         context.sendResponse(request, response);
      }
   }
}
 
源代码22 项目: arcusplatform   文件: PlatformDispatcherFactory.java
private <R> Consumer<PlatformMessage> wrapConsumer(Object ths, Method m, Predicate<Address> p, ArgumentResolverFactory<PlatformMessage, ?> resolver) {
   ArgumentResolverFactory<PlatformMessage, ?> factory =
         this.resolver == null ?
               resolver :
               Resolvers.chain(resolver, (ArgumentResolverFactory) this.resolver);
   Function<PlatformMessage, ?> h = 
         Methods
            .buildInvokerFactory(factory)
            .build()
            .wrapWithThis(m, ths);
   return (message) -> { if(p.apply(message.getSource())) { h.apply(message); } };
}
 
源代码23 项目: arcusplatform   文件: PlaceServiceImpl.java
@Override
public ClientFuture<ListTimezonesResponse> listTimezones() {
   ListTimezonesRequest request = new ListTimezonesRequest();
   request.setAddress(getAddress());
   request.setRestfulRequest(true);

   ClientFuture<ClientEvent> result = client.request(request);
   return Futures.transform(result, new Function<ClientEvent, ListTimezonesResponse>() {
      @Override
      public ListTimezonesResponse apply(ClientEvent input) {
         ListTimezonesResponse response = new ListTimezonesResponse(input);
         return response;
      }
   });
}
 
源代码24 项目: qconfig   文件: ListeningClientsServiceImpl.java
private <T> ListenableFuture<Set<T>> parseData(final List<String> serverUrls, final List<ListenableFuture<Response>> futures, final Function<String, Set<T>> parseFunction) {
    final SettableFuture<Set<T>> result = SettableFuture.create();
    ListenableFuture<List<Response>> responseFuture = Futures.successfulAsList(futures);
    Futures.addCallback(responseFuture, new FutureCallback<List<Response>>() {
        @Override
        public void onSuccess(List<Response> responses) {
            Set<T> allClients = Sets.newHashSet();
            for (int i = 0; i < responses.size(); ++i) {
                Response response = responses.get(i);
                if (response != null && response.getStatusCode() == HttpStatus.SC_OK) {
                    String responseStr = null;
                    try {
                        responseStr = response.getResponseBody("utf8");
                    } catch (IOException e) {
                        logger.warn("get listening client response from server error", e);
                    }
                    allClients.addAll(parseFunction.apply(responseStr));
                } else {
                    logger.warn("get listening clients error with {}", serverUrls.get(i));
                }
            }
            result.set(allClients);
        }

        @Override
        public void onFailure(Throwable t) {
            result.setException(t);
        }
    }, executor);

    return result;
}
 
@Test
public void testRetrieveMetadata() {
    context.registerAdapter(Resource.class, GraphqlClient.class, (Function<Resource, GraphqlClient>) input -> input.getValueMap().get(
        "cq:graphqlClient") != null ? graphqlClient : null);

    final List<FilterAttributeMetadata> filterAttributeMetadata = searchFilterServiceUnderTest
        .retrieveCurrentlyAvailableCommerceFilters(page);

    assertThat(filterAttributeMetadata).hasSize(29);

    // Range type
    FilterAttributeMetadata price = filterAttributeMetadata.stream().filter(f -> f.getAttributeCode().equals("price")).findFirst()
        .get();
    assertThat(price.getFilterInputType()).isEqualTo("FilterRangeTypeInput");
    assertThat(price.getAttributeType()).isEqualTo("Float");
    assertThat(price.getAttributeInputType()).isEqualTo("price");

    // Equal type for string
    FilterAttributeMetadata material = filterAttributeMetadata.stream().filter(f -> f.getAttributeCode().equals("material")).findFirst()
        .get();
    assertThat(material.getFilterInputType()).isEqualTo("FilterEqualTypeInput");
    assertThat(material.getAttributeType()).isEqualTo("String");
    assertThat(material.getAttributeInputType()).isEqualTo("multiselect");

    // Equal type for int/boolean
    FilterAttributeMetadata newAttr = filterAttributeMetadata.stream().filter(f -> f.getAttributeCode().equals("new")).findFirst()
        .get();
    assertThat(newAttr.getFilterInputType()).isEqualTo("FilterEqualTypeInput");
    assertThat(newAttr.getAttributeType()).isEqualTo("Int");
    assertThat(newAttr.getAttributeInputType()).isEqualTo("boolean");
}
 
源代码26 项目: bistoury   文件: VarVersionsGraph.java
private static void addToReversePostOrderListIterative(VarVersionNode root, List<? super VarVersionNode> lst, Set<? super VarVersionNode> setVisited) {
    Map<VarVersionNode, List<VarVersionEdge>> mapNodeSuccs = new HashMap<>();
    LinkedList<VarVersionNode> stackNode = new LinkedList<>();
    LinkedList<Integer> stackIndex = new LinkedList<>();

    stackNode.add(root);
    stackIndex.add(0);

    while (!stackNode.isEmpty()) {
        VarVersionNode node = stackNode.getLast();
        int index = stackIndex.removeLast();

        setVisited.add(node);

        //List<VarVersionEdge> lstSuccs = mapNodeSuccs.computeIfAbsent(node, n -> new ArrayList<>(n.succs));
        List<VarVersionEdge> lstSuccs = Map827.computeIfAbsent(mapNodeSuccs, node, new Function<VarVersionNode, List<VarVersionEdge>>() {
            @Override
            public List<VarVersionEdge> apply(VarVersionNode input) {
                return new ArrayList<>(input.succs);
            }
        });
        for (; index < lstSuccs.size(); index++) {
            VarVersionNode succ = lstSuccs.get(index).dest;

            if (!setVisited.contains(succ)) {
                stackIndex.add(index + 1);
                stackNode.add(succ);
                stackIndex.add(0);
                break;
            }
        }

        if (index == lstSuccs.size()) {
            lst.add(0, node);
            stackNode.removeLast();
        }
    }
}
 
private String[] enumerateDictInfoList(List<DictionaryInfo> dictionaryInfoList, String dataType) throws IOException {
    List<Dictionary<String>> dictList = Lists.transform(dictionaryInfoList, new Function<DictionaryInfo, Dictionary<String>>() {
        @Nullable
        @Override
        public Dictionary<String> apply(@Nullable DictionaryInfo input) {
            return input.dictionaryObject;
        }
    });
    enumerator = new MultipleDictionaryValueEnumerator(DataType.getType(dataType), dictList);
    List<String> values = new ArrayList<>();
    while (enumerator.moveNext()) {
        values.add(enumerator.current());
    }
    return values.toArray(new String[0]);
}
 
源代码28 项目: qconfig   文件: LogServiceImpl.java
private void initQueue() {
    selectBasedVersionQueue = new LinkedBlockingQueue<>(logQueueCapacity);
    configLogSaveQueue = new LinkedBlockingQueue<>(logQueueCapacity);
    configUsedLogSaveQueue = new LinkedBlockingQueue<>(logQueueCapacity);

    logEntryQueueArray = new LinkedBlockingQueue[]{selectBasedVersionQueue, configLogSaveQueue, configUsedLogSaveQueue};
    logEntryFunctionArray = new Function[]{
            new SelectBasedVersionFunction(configDao),
            new ConfigLogSaveFunction(configLogDao),
            new ConfigUsedLogSaveFunction(configUsedLogDao)
    };
}
 
源代码29 项目: arcusplatform   文件: ActionList.java
public Builder addAction(Action action, @Nullable Function<ActionContext, ActionContext> wrapper) {
   Preconditions.checkNotNull(action, "action may not be null");
   if(wrapper == null) {
      wrapper = Functions.<ActionContext>identity();
   }
   actions.add(new Entry(action, wrapper));
   return this;
}
 
源代码30 项目: qconfig   文件: TaskStatusVo.java
public Builder setBatchesAllocation(Map<Integer, List<Host>> batches) {
    Map<Integer, List<Host>> result = Maps.newHashMapWithExpectedSize(batches.size());
    for (Map.Entry<Integer, List<Host>> batch : batches.entrySet()) {
        result.put(batch.getKey(), Lists.transform(batch.getValue(), new Function<Host, Host>() {
            @Override
            public Host apply(Host host) {
                return new Host(host.getIp());
            }
        }));
    }

    this.batchesAllocation = result;
    return this;
}