19 package org.turro.web.funnel.graph;
21 import java.util.Collections;
22 import java.util.List;
23 import java.util.Objects;
25 import java.util.TreeSet;
26 import java.util.stream.Collectors;
27 import org.jgrapht.Graphs;
28 import org.turro.collections.CollectionUtil;
29 import org.turro.elephant.context.IConstructor;
30 import org.turro.elephant.entities.web.WebItem;
31 import org.turro.elephant.web.ElContext;
32 import org.turro.elephant.web.ElContextMap;
33 import org.turro.elephant.entities.web.WebItemType;
34 import org.turro.elephant.web.tags.TagsServlet;
35 import org.turro.graph.GraphUtil;
36 import org.turro.util.Comparison;
82 Set<WebItemType> types = GraphUtil.deepPredecessorListOf(graph,
this, (v) -> v.isActor(), (v) -> v.isActor())
83 .stream().map(v -> v.getItem().getType())
84 .collect(Collectors.toSet());
85 if(types.isEmpty() || types.size() > 1)
return null;
86 WebItemType type = CollectionUtil.from(types).first();
92 return Graphs.successorListOf(graph,
this).stream().collect(Collectors.toCollection(TreeSet::new));
97 case SOLUTION, SERVICE -> GraphUtil.deepPredecessorListOf(graph,
this, (v) -> v.isTarget());
98 default -> Collections.EMPTY_SET;
104 case TARGET -> GraphUtil.deepSuccessorListOf(graph,
this, (v) -> v.isSolution());
105 case SERVICE -> GraphUtil.deepPredecessorListOf(graph,
this, (v) -> v.isSolution());
106 default -> Collections.EMPTY_SET;
112 case TARGET, SOLUTION -> GraphUtil.deepSuccessorListOf(graph,
this, (v) -> v.isService());
113 default -> Collections.EMPTY_SET;
118 return Graphs.neighborSetOf(graph,
this).stream()
119 .filter(vertex -> !vertex.equals(
this))
120 .collect(Collectors.toSet());
127 .collect(Collectors.toCollection(TreeSet::new));
129 .flatMap(v -> v.getSolutions().stream())
131 .collect(Collectors.toCollection(TreeSet::new));
133 .flatMap(v -> v.getServices().stream())
135 .collect(Collectors.toCollection(TreeSet::new));
136 default -> Collections.EMPTY_SET;
145 return item.
getGoals().stream().map(g -> g.getGoalAction()).toList();
150 if(context !=
null) {
162 hash = 97 * hash + Objects.hashCode(this.item);
174 if (getClass() != obj.getClass()) {
178 return Objects.
equals(this.item, other.item);
185 return Comparison.ascendant()
Set< WebGoal > getGoals()
static ElContext getContextFromWebTag(String webTag)
Set< FunnelVertex > getTargets()
FunnelVertex(FunnelGraph graph, WebItem item)
Set< FunnelVertex > getNeighborOf()
Set< FunnelVertex > getServices()
boolean equals(Object obj)
List< String > getGoalActions()
Set< FunnelVertex > getSolutions()
Set< FunnelVertex > getTargets()
int compareTo(FunnelVertex o)
Set< FunnelVertex > getSiblings()
WebItemType getActingType()
Set< FunnelVertex > getNexts()
String getWebPath(IConstructor constructor)
ElContext getCurrentContext()