@Override public void process() { super.process(); getAllHistoricalEvents() .stream() .collect(Filters.filterEvent(ChangeHfStateEvent.class)) .forEach(e -> e.setState("refugee")); }
private void getCurseRoot() { HistoricalFigure parent; do { parent = World.getHistoricalEvents() .stream() .collect( Filters.filterEvent( HfDoesInteractionEvent.class, e -> e.getTargetHfId() == getRoot().hf.getId())) .map(HfDoesInteractionEvent::getDoerHfId) .map(World::getHistoricalFigure) .findFirst() .orElseGet(() -> null); if (parent != null) { root = new FamilyMember(parent, 0, 0); } } while (parent != null); }
private void analyzeBites(FamilyMember m) { if (members.contains(m)) return; members.add(m); World.getHistoricalEvents() .stream() .collect( Filters.filterEvent( HfDoesInteractionEvent.class, e -> e.getDoerHfId() == m.hf.getId() && e.getInteraction().startsWith(interaction))) .map(HfDoesInteractionEvent::getTargetHfId) .map(World::getHistoricalFigure) .forEach( hf -> { FamilyMember m2 = new FamilyMember(hf, m.getGeneration() + 1, m.getDistance() + 1); m2.father = m; m.children.add(m2); links.add(new FamilyLink("child", m, m2)); analyzeBites(m2); }); }