private void markAsFragment(final Multimap<TerminalRule, AbstractRule> calledFrom) { Set<TerminalRule> _keySet = calledFrom.keySet(); final Function1<TerminalRule, Boolean> _function = (TerminalRule it) -> { boolean _isFragment = it.isFragment(); return Boolean.valueOf((!_isFragment)); }; Iterable<TerminalRule> _filter = IterableExtensions.<TerminalRule>filter(_keySet, _function); final Function1<TerminalRule, Boolean> _function_1 = (TerminalRule it) -> { Collection<AbstractRule> _get = calledFrom.get(it); return Boolean.valueOf(this.allAreTerminalRules(_get)); }; Iterable<TerminalRule> _filter_1 = IterableExtensions.<TerminalRule>filter(_filter, _function_1); final Function1<TerminalRule, Boolean> _function_2 = (TerminalRule it) -> { EObject _eContainer = it.eContainer(); EList<AbstractRule> _hiddenTokens = ((Grammar) _eContainer).getHiddenTokens(); boolean _contains = _hiddenTokens.contains(it); return Boolean.valueOf((!_contains)); }; Iterable<TerminalRule> _filter_2 = IterableExtensions.<TerminalRule>filter(_filter_1, _function_2); final Consumer<TerminalRule> _function_3 = (TerminalRule it) -> { it.setFragment(true); }; _filter_2.forEach(_function_3); }
public void doGenerate( final Resource input, final IFileSystemAccess fsa, final Executable2ResultMapping spec2ResultMapping) { this.initResultMapping(spec2ResultMapping); EList<EObject> _contents = input.getContents(); Iterable<XtendFile> _filter = Iterables.<XtendFile>filter(_contents, XtendFile.class); final Consumer<XtendFile> _function = new Consumer<XtendFile>() { public void accept(final XtendFile it) { EList<XtendTypeDeclaration> _xtendTypes = it.getXtendTypes(); Iterable<XtendClass> _filter = Iterables.<XtendClass>filter(_xtendTypes, XtendClass.class); final Consumer<XtendClass> _function = new Consumer<XtendClass>() { public void accept(final XtendClass it) { HtmlFile _createHtmlFile = AbstractDocGenerator.this.createHtmlFile(it); AbstractDocGenerator.this._htmlFileBuilder.generate(it, fsa, _createHtmlFile); } }; _filter.forEach(_function); } }; _filter.forEach(_function); }
@Override public List<Vertex> findApplications(ApplicationQueryBuilder query) { // Iterable<Vertex> vertices = // orientDb.startNoTransaction().getVerticesOfClass("Application"); // select *, out('Uses').id as "uses" from (traverse out('Uses') from #11:0) // select *, out('Uses').id as "uses" from (traverse out('Uses') from (select from // Application where id = 'My Application') where $depth <= 1) // String query = "select *, out('Uses').id as \"uses\" from Application"; String startNodeQuery = "Application"; if (query.startNode != null) { startNodeQuery = String.format( "(traverse %s('Uses') from (select from Application where id = \"%s\") %s)", query.getDirection(), query.startNode, query.getHopsQuery()); } String q = String.format("select %s from %s", query.filterFields(), startNodeQuery); logger.debug("Executing App search query: " + q); OSQLSynchQuery<OrientVertex> qr = new OSQLSynchQuery<>(q); return orientDb.withGraphNoTx( (OrientGraphNoTx db) -> { List<Vertex> result = new ArrayList<>(); Iterable<OrientVertex> vertices = db.command(qr).execute(Collections.emptyMap()); vertices.forEach(result::add); return result; }); }
private void doCompact( LazyDocumentLoader documentLoader, LazyCompactor compactor, SolrQueryResponse rsp, String tsId, String q) throws IOException, SyntaxError { Query query = depProvider.parser(q).getQuery(); Iterable<Document> docs = documentLoader.load(query, SORT); Iterable<CompactionResult> compactionResults = compactor.compact(docs); List<Document> docsToDelete = new LinkedList<>(); List<SolrInputDocument> docsToAdd = new LinkedList<>(); compactionResults.forEach( it -> { docsToDelete.addAll(it.getInputDocuments()); docsToAdd.addAll(it.getOutputDocuments()); }); depProvider.solrUpdateService().add(docsToAdd); depProvider.solrUpdateService().delete(docsToDelete); rsp.add("timeseries " + tsId + " oldNumDocs:", docsToDelete.size()); rsp.add("timeseries " + tsId + " newNumDocs:", docsToAdd.size()); }
private void saveFiles(Iterable files, String entityPath) { if (files != null) files.forEach( file -> { LinkedHashMap map = (LinkedHashMap) file; map.put("path", entityPath); fileStoreService.save(map.get("id").toString()); }); }
private Iterable<Object> saveAndDeleteFiles( JSONArray oldFiles, JSONArray newFiles, String entityPath) { Iterable<Object> toDelete = Sets.difference(Sets.newHashSet(oldFiles), Sets.newHashSet(newFiles)); Iterable<Object> toSave = Sets.difference(Sets.newHashSet(newFiles), Sets.newHashSet(oldFiles)); toDelete.forEach(file -> fileStoreService.delete(((LinkedHashMap) file).get("id").toString())); saveFiles(toSave, entityPath); return toDelete; }
@Nonnull protected Set<MinecraftPlayer> commandSourceIterableToMinecraftPlayer( @Nonnull Iterable<? extends CommandSource> iterable) { Set<MinecraftPlayer> set = new HashSet<>(); iterable.forEach( source -> { if (source instanceof Player) { set.add(new MinecraftPlayer(source.getName(), ((Player) source).getUniqueId())); } }); return set; }
@RequestMapping(value = "/countries", method = RequestMethod.GET) public List<Country> findAll() { final List<Country> countryList = new ArrayList<>(); final Iterable<Country> countries = countryRepository.findAll(); countries.forEach( new Consumer<Country>() { @Override public void accept(Country country) { countryList.add(country); } }); return countryList; }
@Test // @Transactional public void JPANativeQueryTest() { Iterable<CpCtrl> cpCtrlEntries = cpCtrlRepository.cpCtrlTest(2, "01", 2, "1", "20151127"); cpCtrlEntries.forEach( c -> { System.out.println(c.getId().getRegstDay()); System.out.println(c.getId().getRegstTime()); // System.out.println(c.getCtrlParameter().toString()); System.out.println(c.getOutletStat()); System.out.println(c.getRegst()); }); }
@Impure @NoExcept @Nonnull @ExtensionMethod public static <T, TNode extends ITypedMutableTreeNode<T, TNode>> TNode addAll( final TNode thisNode, final Iterable<? extends TNode> children) { Preconditions.checkNotNull(thisNode); Preconditions.checkNotNull(children); children.forEach(thisNode::addSafely); // for (final TNode child : children) { // thisNode.addSafely(child); // } return thisNode; }
public <E> void write( Json json, Iterable<E> entries, Function<E, ?> getKey, Function<E, ?> getValue) { json.writeArrayStart(name); entries.forEach( entry -> { json.writeObjectStart(); json.writeValue("key", getKey.apply(entry), map.key()); json.writeValue("value", getValue.apply(entry), map.value()); json.writeObjectEnd(); }); json.writeArrayEnd(); }
@JsonApiFindOne public Project findOne(Long projectId, QueryParams requestParams) { if (projectId == null) { return null; } Project project = REPOSITORY.get(projectId); if (project == null) { throw new ResourceNotFoundException("Project not found!"); } if (project.getTasks().isEmpty()) { Iterable<Task> tasks = taskRepository.findAll(null); tasks.forEach( task -> { if (task.getProjectId().equals(project.getId())) { project.getTasks().add(task); } }); save(project); } return project; }
@Benchmark public void lambda() { lambda.forEach(c); }
// @Benchmark public void singleton() { singleton.forEach(c); }
// @Benchmark public void singletonList() { singletonList.forEach(c); }
@Test // @Transactional public void JPATest() { QB2gHist b2gHist = QB2gHist.b2gHist; Path<?> stDayPath = QB2gHist.b2gHist.id.stDay; Expression<String> constant = Expressions.constant("201511%"); Predicate predicate = Expressions.predicate(Ops.LIKE, stDayPath, constant); Iterable<B2gHist> b2gHistEntries = b2gHistRepository.findAll(predicate); log.info("-------------------" + b2gHistEntries); b2gHistEntries.forEach( h -> { log.info("++++++++++++++++++++++++++++++++++++++++++++++"); log.info(h.getId().getStDay()); log.info(h.getSendResMsg()); log.info(h.getEndDay()); log.info(h.getEndTime()); log.info(h.getSendDay()); log.info(h.getSender()); log.info(h.getUpdateDay()); log.info(h.getUpdateTime()); log.info("-------------------------------------------------"); }); // log.info(netStatRepository.findByReceiverId("EcsiKdn")); log.info("XXXXXXXXXXXXXXXXXXXX com_cd start XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); QComCd comCd = QComCd.comCd; comCd.delYn.coalesce("Y"); comCdRepository .findAll(comCd.delYn.eq("Y").and(comCd.updateDatetime.after(new Date(2010, 7, 1)))) .forEach( c -> { log.info(c.getUpdateDatetime()); log.info(c.getCdDesc()); log.info(c.getCdNm()); log.info(c.getDelYn()); }); log.info("XXXXXXXXXXXXXXXXXXXX com_cd end XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); // ProtocolInfo pi = protocolInfoRepository.findOne(1); Optional<ProtocolInfo> pi = protocolInfoRepository.findOneByProtocolType(2); System.out.println(pi.get().getProtocolName()); System.out.println(pi.get().getProtocolType()); // 조인걸린 데이터 값들 가져오는거 if (pi.isPresent()) { pi.get().getCpCompanyInfo().getEquipInfos().get(0).getCpCompanyInfo().getAddress(); pi.get() .getEquipInfos() .iterator() .forEachRemaining( e -> { log.info(e.getAlterDate()); log.info(e.getAuthKey()); }); // pi.setProtocolVer("jeju version 234324"); // pi.setProtocolName("gwangju protocol 234234"); // protocolInfoRepository.save(pi); protocolInfoRepository .findAll() .forEach( p -> { // update query // p.setProtocolVer("jeju version 2"); // p.setProtocolName("jeju protocol 2"); // protocolInfoRepository.save(p); log.info(p.getCpCompanyInfo()); log.info("||||||||||||||| start equip info ||||||||||||||"); // p.getEquipInfos().iterator().forEachRemaining(e -> { // log.info(e.getAlterDate()); // log.info(e.getAuthKey()); // }); log.info("||||||||||||||| end equip info ||||||||||||||"); log.info(p.getCpCompanyInfo().getHomepage()); log.info(p.getCpCompanyInfo().getFax()); }); } EquipInfo ei = equipInfoRepository.findOne(4); ei.setOpData("This is json string".getBytes()); equipInfoRepository.save(ei); /* Customer customer = new Customer(); Customer cl = customerRepository.findByCustomerNo(234324234L); if (cl.equals(null)) { customer.setCustomerNo(234324234L); customer.setName("Foo"); customer.setMileage(new BigDecimal(2342)); Customer c2 = customerRepository.save(customer); } for (Customer c : customerRepository.findAll()){ log.info(c.getName()); } Customer c = customerRepository.findByName("Foo"); log.info(c.getName()); Address a = new Address(); a.setLine1("abc_test"); a.setCustomer(c); addressRepository.save(a); */ }
public void addAll(Iterable<NodeMetadata> manyNodes) { manyNodes.forEach(this::addNode); }
@Override public Document putAll(Iterable<Field> object) { object.forEach(this::setValue); return this; }
public Builder addRules(Iterable<Rule> rules) { rules.forEach(r -> addRule(r)); return this; }
@Override public void forEach(Consumer<? super Bindings> action) { Iterable.super.forEach(action); }
// @Benchmark public void lambdaBugged() { lambdaBugged.forEach(c); }
@Override public void accept(Iterable<E> es) { es.forEach(consumer); }
static void check( final ErrorCollectorIfc errorCollector, final Iterable<RuleDecl> ruleDecls, final ScopeIfc<RelationDecl> relationDecls) { ruleDecls.forEach(ruleDecl -> check(errorCollector, ruleDecl, relationDecls)); }