public Transformer getTransformer(String sourceType, String resultType) { loadTransformers(); DirectedGraph<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType); return (edge == null) ? null : edge.getValue(); }
private Path getPath(Node t) { if (t.distance == Integer.MAX_VALUE) { return NULL_PATH; } Path path = new Path(); Node u = t; while (u.previous != null) { Edge edge = getEdge(u.previous.vertex, u.vertex); path.addEdge(edge); u = u.previous; } return path; }
private Path getPath(Node t) { if (t.distance == Integer.MAX_VALUE) { return NULL_PATH; } Path path = new Path(); Node u = t; while (u.previous != null) { Edge edge = getEdge(u.previous.vertex, u.vertex); path.addEdge(edge); u = u.previous; } return path; }
public Transformer getTransformer(String sourceType, String resultType) { loadTransformers(); DirectedGraph<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType); return (edge == null) ? null : edge.getValue(); }
public List<Transformer> getTransformerChain(String sourceType, String resultType) { loadTransformers(); String source = sourceType; String result = resultType; List<Transformer> transformers = new ArrayList<Transformer>(); // First check if there is a direct path, if yes, use it regardless of the weight DirectedGraph<Object, Transformer>.Edge link = graph.getEdge(sourceType, resultType); if (link != null) { transformers.add(link.getValue()); } else { DirectedGraph<Object, Transformer>.Path path = graph.getShortestPath(source, result); if (path == null) { return null; } for (DirectedGraph<Object, Transformer>.Edge edge : path.getEdges()) { transformers.add(edge.getValue()); } } return transformers; }
public Edge getEdge(V source, V target) { Vertex sv = getVertex(source); if (sv == null) { return null; } Vertex tv = getVertex(target); if (tv == null) { return null; } return getEdge(getVertex(source), getVertex(target)); }
public List<Transformer> getTransformerChain(String sourceType, String resultType) { loadTransformers(); String source = sourceType; String result = resultType; List<Transformer> transformers = new ArrayList<Transformer>(); // First check if there is a direct path, if yes, use it regardless of the weight DirectedGraph<Object, Transformer>.Edge link = graph.getEdge(sourceType, resultType); if (link != null) { transformers.add(link.getValue()); } else { DirectedGraph<Object, Transformer>.Path path = graph.getShortestPath(source, result); if (path == null) { return null; } for (DirectedGraph<Object, Transformer>.Edge edge : path.getEdges()) { transformers.add(edge.getValue()); } } return transformers; }
public void addEdge(V source, V target, E edgeValue, int weight, boolean publicEdge) { // Fix for TUSCANY-3456 // First check if we already has an edge Edge edge = getEdge(source, target); if (edge != null) { // An existing edge has higher weight, let's replace it if (edge.weight > weight) { logger.fine("An edge exists with higher weight: " + edge); removeEdge(edge); } else { // Don't add this edge logger.fine("An edge exists with lower weight: " + edge); return; } } Vertex s = getVertex(source); if (s == null) { s = new Vertex(source); vertices.put(source, s); } Vertex t = getVertex(target); if (t == null) { t = new Vertex(target); vertices.put(target, t); } edge = new Edge(s, t, edgeValue, weight, publicEdge); s.outEdges.put(t, edge); t.inEdges.put(s, edge); }
public void addEdge(V source, V target, E edgeValue, int weight, boolean publicEdge) { // Fix for TUSCANY-3456 // First check if we already has an edge Edge edge = getEdge(source, target); if (edge != null) { // An existing edge has higher weight, let's replace it if (edge.weight > weight) { logger.fine("An edge exists with higher weight: " + edge); removeEdge(edge); } else { // Don't add this edge logger.fine("An edge exists with lower weight: " + edge); return; } } Vertex s = getVertex(source); if (s == null) { s = new Vertex(source); vertices.put(source, s); } Vertex t = getVertex(target); if (t == null) { t = new Vertex(target); vertices.put(target, t); } edge = new Edge(s, t, edgeValue, weight, publicEdge); s.outEdges.put(t, edge); t.inEdges.put(s, edge); }
public Edge getEdge(V source, V target) { Vertex sv = getVertex(source); if (sv == null) { return null; } Vertex tv = getVertex(target); if (tv == null) { return null; } return getEdge(getVertex(source), getVertex(target)); }
Edge direct = getEdge(source, target); path = new Path(); if (direct != null) {
Edge direct = getEdge(source, target); path = new Path(); if (direct != null) {