org.jgrapht.DirectedGraph Java Examples
The following examples show how to use
org.jgrapht.DirectedGraph.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenerateDOTMojo.java From furnace with Eclipse Public License 1.0 | 6 votes |
void toDOT(File file, DirectedGraph<AddonVertex, AddonDependencyEdge> graph) { DOTExporter<AddonVertex, AddonDependencyEdge> exporter = new DOTExporter<>( new IntegerNameProvider<AddonVertex>(), new AddonVertexNameProvider(), new AddonDependencyEdgeNameProvider()); try (FileWriter fw = new FileWriter(file)) { exporter.export(fw, graph); fw.flush(); } catch (IOException e) { e.printStackTrace(); } }
Example #2
Source File: BuildTGDStratification.java From Llunatic with GNU General Public License v3.0 | 6 votes |
private DirectedGraph<TGDStratum, DefaultEdge> buildStrataGraph(DirectedGraph<Dependency, DefaultEdge> dependencyGraph, List<TGDStratum> tgdStrata) { DirectedGraph<TGDStratum, DefaultEdge> strataGraph = new DefaultDirectedGraph<TGDStratum, DefaultEdge>(DefaultEdge.class); for (TGDStratum stratum : tgdStrata) { strataGraph.addVertex(stratum); } for (TGDStratum stratumA : tgdStrata) { for (TGDStratum stratumB : tgdStrata) { if(stratumA.equals(stratumB)){ continue; } if (existsPath(dependencyGraph, stratumA, stratumB)) { strataGraph.addEdge(stratumA, stratumB); } } } return strataGraph; }
Example #3
Source File: ModelInfoGraphAnalyzer.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 6 votes |
private Map<String, Set<InfoVertex<T, C>>> createPackageVerticesMap( DirectedGraph<InfoVertex<T, C>, DependencyEdge> graph) { final Map<String, Set<InfoVertex<T, C>>> packageVerticesMap = new HashMap<String, Set<InfoVertex<T, C>>>(); for (InfoVertex<T, C> vertex : graph.vertexSet()) { final MPackageInfo packageInfo = vertex.getPackageInfo(); if (packageInfo != null) { Set<InfoVertex<T, C>> packageVertices = packageVerticesMap .get(packageInfo.getPackageName()); if (packageVertices == null) { packageVertices = new HashSet<InfoVertex<T, C>>(); packageVerticesMap.put(packageInfo.getPackageName(), packageVertices); } packageVertices.add(vertex); } } return packageVerticesMap; }
Example #4
Source File: BuildEGDStratification.java From Llunatic with GNU General Public License v3.0 | 6 votes |
private DirectedGraph<EGDStratum, DefaultEdge> buildEGDStrataGraph(DirectedGraph<ExtendedEGD, DefaultEdge> dependencyGraph, List<EGDStratum> egdStrata) { DirectedGraph<EGDStratum, DefaultEdge> strataGraph = new DefaultDirectedGraph<EGDStratum, DefaultEdge>(DefaultEdge.class); for (EGDStratum stratum : egdStrata) { strataGraph.addVertex(stratum); } for (EGDStratum stratumA : egdStrata) { for (EGDStratum stratumB : egdStrata) { if(stratumA.equals(stratumB)){ continue; } if (existsPath(dependencyGraph, stratumA, stratumB)) { strataGraph.addEdge(stratumA, stratumB); } } } return strataGraph; }
Example #5
Source File: CheckConflicts.java From Llunatic with GNU General Public License v3.0 | 6 votes |
private Map<AttributeRef, Set<AttributeRef>> findProvenance(Scenario scenario) { DirectedGraph<AttributeRef, DefaultEdge> propagationGraph = buildTGDPropagationGraph(scenario); if (logger.isDebugEnabled()) logger.debug("Propagation graph: " + propagationGraph); Map<AttributeRef, Set<AttributeRef>> result = new HashMap<AttributeRef, Set<AttributeRef>>(); for (String tableName : scenario.getTarget().getTableNames()) { ITable table = scenario.getTarget().getTable(tableName); for (Attribute attribute : table.getAttributes()) { if (attribute.getName().equals(SpeedyConstants.OID)) { continue; } AttributeRef targetAttribute = new AttributeRef(tableName, attribute.getName()); Set<AttributeRef> sourceAttributes = findReachableSourceAttributes(targetAttribute, propagationGraph); result.put(targetAttribute, sourceAttributes); } } return result; }
Example #6
Source File: ModelAssembler.java From gama with GNU General Public License v3.0 | 6 votes |
private Iterable<SpeciesDescription> getSpeciesInHierarchicalOrder(final ModelDescription model) { final DirectedGraph<SpeciesDescription, Object> hierarchy = new SimpleDirectedGraph<>(Object.class); final DescriptionVisitor visitor = desc -> { if (desc instanceof ModelDescription) { return true; } final SpeciesDescription sd = ((SpeciesDescription) desc).getParent(); if (sd == null || sd == desc) { return false; } hierarchy.addVertex((SpeciesDescription) desc); if (!sd.isBuiltIn()) { hierarchy.addVertex(sd); hierarchy.addEdge(sd, (SpeciesDescription) desc); } return true; }; model.visitAllSpecies(visitor); return () -> new TopologicalOrderIterator<>(hierarchy); }
Example #7
Source File: CheckWeaklyAcyclicityInTGDs.java From Llunatic with GNU General Public License v3.0 | 6 votes |
private void checkCycleBetweenSpecialEdge(List<AttributeRef> cycle, DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph, LunaticConfiguration conf) { cycle.add(cycle.get(0)); for (int i = 0; i < cycle.size() - 1; i++) { AttributeRef nodei = cycle.get(i); AttributeRef nodej = cycle.get(i + 1); ExtendedEdge edge = dependencyGraph.getEdge(nodei, nodej); if (edge.isSpecial()) { String message = "TGDs are not weakly acyclic. Termination is not guarantee. Cycle with special edge(s): " + cycle; if (conf.isStopOnNotWA()) { throw new ChaseException(message); } else { logger.error(message); break; } } } }
Example #8
Source File: BuildFaginDependencyGraph.java From Llunatic with GNU General Public License v3.0 | 6 votes |
private void addNodes(DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph, IFormula formula, Set<AttributeRef> positionsAdded) { for (IFormulaAtom atom : formula.getAtoms()) { if (!(atom instanceof RelationalAtom)) { continue; } RelationalAtom relationalAtom = (RelationalAtom) atom; if (relationalAtom.isSource()) { continue; } String tableName = relationalAtom.getTableAlias().getTableName(); for (FormulaAttribute attribute : relationalAtom.getAttributes()) { String attributeName = attribute.getAttributeName(); AttributeRef position = buildPosition(tableName, attributeName); if (positionsAdded.contains(position)) { continue; } dependencyGraph.addVertex(position); positionsAdded.add(position); } } }
Example #9
Source File: GenerateStratification.java From BART with MIT License | 6 votes |
private DirectedGraph<Dependency, DefaultEdge> initDependencyGraph(List<Dependency> dependencies, Map<Dependency, Set<AttributeRef>> affectedAttributes, Map<Dependency, Set<AttributeRef>> queriedAttributes) { DirectedGraph<Dependency, DefaultEdge> dependencyGraph = new DefaultDirectedGraph<Dependency, DefaultEdge>(DefaultEdge.class); for (Dependency dependency : dependencies) { dependencyGraph.addVertex(dependency); } for (int i = 0; i < dependencies.size(); i++) { Dependency d1 = dependencies.get(i); for (int j = 0; j < dependencies.size(); j++) { if (i == j) { continue; } Dependency d2 = dependencies.get(j); if (haveOverlap(d1, d2, affectedAttributes, queriedAttributes)) { if (logger.isDebugEnabled()) logger.debug("Edge btw " + d1.getId() + " and " + d2.getId()); dependencyGraph.addEdge(d1, d2); } } } return dependencyGraph; }
Example #10
Source File: CheckWeaklyAcyclicityInTGDs.java From Llunatic with GNU General Public License v3.0 | 5 votes |
public void check(DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph, List<Dependency> extTGDs, LunaticConfiguration conf) { if (extTGDs.isEmpty()) { return; } if (logger.isDebugEnabled()) logger.debug("**** Checking weakly acyclicity"); TarjanSimpleCycles<AttributeRef, ExtendedEdge> cycleDetector = new TarjanSimpleCycles<AttributeRef, ExtendedEdge>(dependencyGraph); List<List<AttributeRef>> cycles = cycleDetector.findSimpleCycles(); if (logger.isDebugEnabled()) logger.debug("*** Cycles: " + cycles); for (List<AttributeRef> cycle : cycles) { checkCycleBetweenSpecialEdge(cycle, dependencyGraph, conf); } if (logger.isDebugEnabled()) logger.debug("Dependency graph: " + dependencyGraph); if (logger.isDebugEnabled()) logger.debug("**** Weakly acyclicity checked!"); }
Example #11
Source File: FindAttributesInSameCellGroup.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private void addVerticesInPath(List<ExtendedEdge> path, Set<AttributeRef> result, Set<String> pathCache, DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph) { List<AttributeRef> vertices = findVerticesInPath(dependencyGraph, path); result.addAll(vertices); for (int i = 0; i < vertices.size() - 1; i++) { for (int j = i + 1; j < vertices.size(); j++) { AttributeRef sourceVertex = vertices.get(i); AttributeRef targetVertex = vertices.get(j); pathCache.add(buildAttributePair(sourceVertex, targetVertex)); } } }
Example #12
Source File: GraphUtils.java From Nicobar with Apache License 2.0 | 5 votes |
/** * Add all of the vertices to the graph without any edges. If the the graph * already contains any one of the vertices, that vertex is not added. * @param graph graph to be mutated * @param vertices vertices to add */ public static <V> void addAllVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) { // add all of the new vertices to prep for linking for (V vertex : vertices) { graph.addVertex(vertex); } }
Example #13
Source File: GenerateDOTMojo.java From furnace with Eclipse Public License 1.0 | 5 votes |
DirectedGraph<AddonVertex, AddonDependencyEdge> toGraph(AddonDependencyResolver addonResolver, AddonInfo info) { DirectedGraph<AddonVertex, AddonDependencyEdge> graph = new DefaultDirectedGraph<AddonVertex, AddonDependencyEdge>( AddonDependencyEdge.class); populateGraph(addonResolver, info, graph); return graph; }
Example #14
Source File: ModelInfoGraphAnalyzer.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
public ModelInfoGraphAnalyzer(JsonixContext context, MModelInfo<T, C> modelInfo) { final DirectedGraph<InfoVertex<T, C>, DependencyEdge> graph = new ModelInfoGraphBuilder<T, C>( context, modelInfo).build(); this.packageVertexMap = createPackageVertexMap(graph); this.packageInfoMap = createPackageInfoMap(this.packageVertexMap); this.packageNames = this.packageInfoMap.keySet(); this.packageInfos = this.packageInfoMap.values(); this.packageVerticesMap = createPackageVerticesMap(graph); this.graph = graph; this.typeInfoMap = createTypeInfoMap(modelInfo); this.elementInfoMap = createElementInfoMap(modelInfo); this.propertyInfoMap = createPropertyInfoMap(modelInfo); // this.connectivityInspector = new ConnectivityInspector<InfoVertex<T, // C>, DependencyEdge>( // this.graph); // for (PackageInfoVertex<T, C> packageInfoVertex : // this.packageVertexMap // .values()) { // System.out // .println(packageInfoVertex // + " is connected to the following vertices in other packages:"); // final Set<InfoVertex<T, C>> connectedVertices = // connectedSetOf(packageInfoVertex); // for (InfoVertex<T, C> connectedVertex : connectedVertices) { // if (connectedVertex.getPackageInfo() != null // && connectedVertex.getPackageInfo() != packageInfoVertex // .getPackageInfo()) { // System.out.println(" " + connectedVertex); // } // } // } }
Example #15
Source File: TridentUtils.java From jstorm with Apache License 2.0 | 5 votes |
/** * Assumes edge contains an index */ public static <T> List<T> getParents(DirectedGraph g, T n) { List<IndexedEdge> incoming = new ArrayList(g.incomingEdgesOf(n)); Collections.sort(incoming); List<T> ret = new ArrayList(); for(IndexedEdge e: incoming) { ret.add((T)e.source); } return ret; }
Example #16
Source File: Mapping.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
public Collection<MappingDependency<T, C>> getDirectDependencies() { final Map<MPackageInfo, MappingDependency<T, C>> dependencies = new HashMap<MPackageInfo, MappingDependency<T, C>>(); final DirectedGraph<InfoVertex<T, C>, DependencyEdge> graph = analyzer .getGraph(); final Collection<InfoVertex<T, C>> vertices = new HashSet<InfoVertex<T, C>>( getInfoVertices()); for (InfoVertex<T, C> sourceVertex : vertices) { final Set<DependencyEdge> edges = graph .outgoingEdgesOf(sourceVertex); for (DependencyEdge edge : edges) { if (edge.getType() == DependencyType.HARD) { final InfoVertex<T, C> targetVertex = graph .getEdgeTarget(edge); final MPackageInfo packageInfo = targetVertex .getPackageInfo(); // If this another package (not this package and not the // built-in package) if (packageInfo != null && !this.packageInfo.equals(packageInfo)) { MappingDependency<T, C> dependency = dependencies .get(packageInfo); if (dependency == null) { dependency = new MappingDependency<T, C>( packageInfo); dependencies.put(packageInfo, dependency); } dependency.addInfoVertex(targetVertex); } } } } return dependencies.values(); }
Example #17
Source File: TTGDStratification.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private void showEGDGraph(DirectedGraph<EGDStratum, DefaultEdge> strataGraph) { JGraphXAdapter<EGDStratum, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<EGDStratum, DefaultEdge>(strataGraph); jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1"); // jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0"); jgxAdapterContext.setCellsEditable(false); jgxAdapterContext.setCellsMovable(false); jgxAdapterContext.setEdgeLabelsMovable(false); jgxAdapterContext.setCellsDeletable(false); jgxAdapterContext.setCellsDisconnectable(false); jgxAdapterContext.setCellsResizable(false); jgxAdapterContext.setCellsBendable(false); JFrame frame = new JFrame(); mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext); frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER); mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext); layout.execute(jgxAdapterContext.getDefaultParent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Graph"); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); try { BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null); ImageIO.write(image, "PNG", new File("/Temp/llunatic/egd-graph.png")); } catch (IOException ex) { logger.error("Unable to save graph image: " + ex.getLocalizedMessage()); } }
Example #18
Source File: TTGDStratification.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private void showTGDGraph(DirectedGraph<TGDStratum, DefaultEdge> strataGraph) { JGraphXAdapter<TGDStratum, DefaultEdge> jgxAdapterContext = new JGraphXAdapter<TGDStratum, DefaultEdge>(strataGraph); jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_NOLABEL, "1"); // jgxAdapterContext.getStylesheet().getDefaultEdgeStyle().put(mxConstants.STYLE_ENDARROW, "0"); jgxAdapterContext.setCellsEditable(false); jgxAdapterContext.setCellsMovable(false); jgxAdapterContext.setEdgeLabelsMovable(false); jgxAdapterContext.setCellsDeletable(false); jgxAdapterContext.setCellsDisconnectable(false); jgxAdapterContext.setCellsResizable(false); jgxAdapterContext.setCellsBendable(false); JFrame frame = new JFrame(); mxGraphComponent mxGraphComponent = new mxGraphComponent(jgxAdapterContext); frame.getContentPane().add(mxGraphComponent, BorderLayout.CENTER); mxHierarchicalLayout layout = new mxHierarchicalLayout(jgxAdapterContext); layout.execute(jgxAdapterContext.getDefaultParent()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Graph"); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); try { BufferedImage image = mxCellRenderer.createBufferedImage(jgxAdapterContext, null, 1, Color.WHITE, true, null); ImageIO.write(image, "PNG", new File("/Temp/llunatic/tgd-graph.png")); } catch (IOException ex) { logger.error("Unable to save graph image: " + ex.getLocalizedMessage()); } }
Example #19
Source File: GraphUtils.java From Nicobar with Apache License 2.0 | 5 votes |
/** * Removes vertices from graph * @param graph raph to mutate * @param vertices vertices to remove */ public static <V> void removeVertices(DirectedGraph<V, DefaultEdge> graph, Set<V> vertices) { for (V vertex : vertices) { if (graph.containsVertex(vertex)) { graph.removeVertex(vertex); } } }
Example #20
Source File: AnalyzeDependencies.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private DirectedGraph<AttributeRef, ExtendedEdge> removeSpecialEdges(DirectedGraph<AttributeRef, ExtendedEdge> faginDependencyGraph) { DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph = new DefaultDirectedGraph<AttributeRef, ExtendedEdge>(ExtendedEdge.class); if (faginDependencyGraph == null) { return dependencyGraph; } Graphs.addGraph(dependencyGraph, faginDependencyGraph); for (ExtendedEdge edge : faginDependencyGraph.edgeSet()) { if (edge.isSpecial() && !edge.isNormal()) { dependencyGraph.removeEdge(edge); } } return dependencyGraph; }
Example #21
Source File: BuildEGDStratification.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private boolean existsPath(DirectedGraph<ExtendedEGD, DefaultEdge> dependencyGraph, EGDStratum t1, EGDStratum t2) { for (ExtendedEGD dependency1 : t1.getExtendedDependencies()) { for (ExtendedEGD dependency2 : t2.getExtendedDependencies()) { if (dependencyGraph.containsEdge(dependency1, dependency2)) { return true; } } } return false; }
Example #22
Source File: JBossModuleLoader.java From Nicobar with Apache License 2.0 | 5 votes |
/** * Construct the Module dependency graph of a module loader where each vertex is the module name * @return a mutable snapshot of the underlying dependency */ public DirectedGraph<ModuleId, DefaultEdge> getModuleNameGraph() { SimpleDirectedGraph<ModuleId, DefaultEdge> graph = new SimpleDirectedGraph<ModuleId, DefaultEdge>(DefaultEdge.class); Map<ModuleId, ModuleIdentifier> moduleIdentifiers = getLatestRevisionIds(); GraphUtils.addAllVertices(graph, moduleIdentifiers.keySet()); for (Entry<ModuleId, ModuleIdentifier> entry : moduleIdentifiers.entrySet()) { ModuleId scriptModuleId = entry.getKey(); ModuleIdentifier revisionID = entry.getValue(); ModuleSpec moduleSpec = moduleSpecs.get(revisionID); Set<ModuleId> dependencyNames = getDependencyScriptModuleIds(moduleSpec); GraphUtils.addOutgoingEdges(graph, scriptModuleId, dependencyNames); } return graph; }
Example #23
Source File: BuildTGDStratification.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private boolean existsPath(DirectedGraph<Dependency, DefaultEdge> dependencyGraph, TGDStratum t1, TGDStratum t2) { for (Dependency dependency1 : t1.getTgds()) { for (Dependency dependency2 : t2.getTgds()) { if (dependencyGraph.containsEdge(dependency1, dependency2)) { return true; } } } return false; }
Example #24
Source File: FindAttributesInSameCellGroup.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private Set<AttributeRef> findRelatedAttributes(AttributeRef attribute, Set<String> pathCache, DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph) { //All attributes corresponding to vertices of paths that pass throught the vertex of attribute Set<AttributeRef> result = new HashSet<AttributeRef>(); for (AttributeRef otherAttribute : dependencyGraph.vertexSet()) { if (attribute.equals(otherAttribute)) { result.add(otherAttribute); continue; } String attributePair = buildAttributePair(attribute, otherAttribute); if (pathCache.contains(attributePair)) { result.add(otherAttribute); continue; } List<ExtendedEdge> outPath = DijkstraShortestPath.findPathBetween(dependencyGraph, attribute, otherAttribute); if (logger.isDebugEnabled()) logger.debug("Finding path between " + attribute + " and " + otherAttribute); if (outPath != null) { if (logger.isDebugEnabled()) logger.debug("Path found"); addVerticesInPath(outPath, result, pathCache, dependencyGraph); continue; } List<ExtendedEdge> inPath = DijkstraShortestPath.findPathBetween(dependencyGraph, otherAttribute, attribute); if (logger.isDebugEnabled()) logger.debug("Finding path between " + otherAttribute + " and " + attribute); if (inPath != null) { if (logger.isDebugEnabled()) logger.debug("Path found"); addVerticesInPath(inPath, result, pathCache, dependencyGraph); } } return result; }
Example #25
Source File: FindAttributesInSameCellGroup.java From Llunatic with GNU General Public License v3.0 | 5 votes |
public AttributesInSameCellGroups findAttributes(DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph) { AttributesInSameCellGroups attributesInSameCallGroups = new AttributesInSameCellGroups(); Set<String> pathCache = new HashSet<String>(); for (AttributeRef attributeRef : dependencyGraph.vertexSet()) { Set<AttributeRef> relatedAttributes = findRelatedAttributes(attributeRef, pathCache, dependencyGraph); attributesInSameCallGroups.addAttribute(attributeRef, relatedAttributes); } if (logger.isDebugEnabled()) logger.debug("Map for dependency graph " + dependencyGraph + "\n:" + attributesInSameCallGroups.toString()); return attributesInSameCallGroups; }
Example #26
Source File: BuildFaginDependencyGraph.java From Llunatic with GNU General Public License v3.0 | 5 votes |
public DirectedGraph<AttributeRef, ExtendedEdge> buildGraph(List<Dependency> extTGDs) { if (extTGDs.isEmpty()) { return null; } if (logger.isDebugEnabled()) logger.debug("**** Checking weakly acyclicity"); DirectedGraph<AttributeRef, ExtendedEdge> dependencyGraph = new DefaultDirectedGraph<AttributeRef, ExtendedEdge>(ExtendedEdge.class); Set<AttributeRef> positionsAdded = new HashSet<AttributeRef>(); for (Dependency extTGD : extTGDs) { addNodes(dependencyGraph, extTGD.getPremise(), positionsAdded); addNodes(dependencyGraph, extTGD.getConclusion(), positionsAdded); addEdges(dependencyGraph, extTGD); } if (logger.isDebugEnabled()) logger.debug("Dependency graph: " + dependencyGraph); return dependencyGraph; }
Example #27
Source File: ScheduleEGDStrata.java From Llunatic with GNU General Public License v3.0 | 5 votes |
public void addSatisfiedStratum(EGDStratum egdStratum) { this.unsatisfiedStrataLock.lock(); try { if (logger.isDebugEnabled()) logger.debug("** Stratum satisfied: " + egdStratum); this.unsatisfiedStrata.remove(egdStratum); this.unsatisfiedStrataCondition.signalAll(); DirectedGraph<EGDStratum, DefaultEdge> strataGraph = scenario.getStratification().getEgdStrataGraph(); for (DefaultEdge outEdge : strataGraph.outgoingEdgesOf(egdStratum)) { EGDStratum nextStratum = strataGraph.getEdgeTarget(outEdge); this.startThreadForEGDStratum(nextStratum); } } finally { this.unsatisfiedStrataLock.unlock(); } }
Example #28
Source File: ScheduleEGDStrata.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private boolean allPreviousStrataAreSatisfied(EGDStratum egdStratum) { this.unsatisfiedStrataLock.lock(); try { DirectedGraph<EGDStratum, DefaultEdge> strataGraph = scenario.getStratification().getEgdStrataGraph(); for (DefaultEdge inEdge : strataGraph.incomingEdgesOf(egdStratum)) { EGDStratum prevStratum = strataGraph.getEdgeSource(inEdge); if (unsatisfiedStrata.contains(prevStratum)) { return false; } } return true; } finally { this.unsatisfiedStrataLock.unlock(); } }
Example #29
Source File: ScheduleTGDStrata.java From Llunatic with GNU General Public License v3.0 | 5 votes |
public void addSatisfiedStratum(TGDStratum tgdStratum) { this.unsatisfiedStrataLock.lock(); try { if (logger.isDebugEnabled()) logger.debug("** Stratum satisfied: " + tgdStratum); this.unsatisfiedStrata.remove(tgdStratum); this.unsatisfiedStrataCondition.signalAll(); DirectedGraph<TGDStratum, DefaultEdge> strataGraph = scenario.getStratification().getTgdStrataGraph(); for (DefaultEdge outEdge : strataGraph.outgoingEdgesOf(tgdStratum)) { TGDStratum nextStratum = strataGraph.getEdgeTarget(outEdge); this.startThreadForTGDStratum(nextStratum); } } finally { this.unsatisfiedStrataLock.unlock(); } }
Example #30
Source File: ScheduleTGDStrata.java From Llunatic with GNU General Public License v3.0 | 5 votes |
private boolean allPreviousStrataAreSatisfied(TGDStratum tgdStratum) { this.unsatisfiedStrataLock.lock(); try { DirectedGraph<TGDStratum, DefaultEdge> strataGraph = scenario.getStratification().getTgdStrataGraph(); for (DefaultEdge inEdge : strataGraph.incomingEdgesOf(tgdStratum)) { TGDStratum prevStratum = strataGraph.getEdgeSource(inEdge); if (unsatisfiedStrata.contains(prevStratum)) { return false; } } return true; } finally { this.unsatisfiedStrataLock.unlock(); } }