mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-07 13:30:45 -05:00
Removed uses of TransformedMap
This commit is contained in:
+4
-7
@@ -4,9 +4,9 @@
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.collections4.*;
|
||||
import org.apache.commons.collections4.map.LazyMap;
|
||||
|
||||
import edu.uci.ics.jung.algorithms.layout.Layout;
|
||||
import edu.uci.ics.jung.graph.Graph;
|
||||
@@ -241,10 +241,7 @@ class ArticulatedEdgeRouter<V extends VisualVertex, E extends VisualEdge<V>>
|
||||
Layout<V, E> layout = viewer.getGraphLayout();
|
||||
Graph<V, E> graph = layout.getGraph();
|
||||
|
||||
Set<V> prototype = new HashSet<>();
|
||||
Factory<Set<V>> factory = FactoryUtils.prototypeFactory(prototype);
|
||||
Map<E, Set<V>> map = MapUtils.lazyMap(new HashMap<E, Set<V>>(), factory);
|
||||
|
||||
LazyMap<E, Set<V>> map = LazyMap.lazyMap(new HashMap<E, Set<V>>(), () -> new HashSet<>());
|
||||
Map<V, Rectangle> vertexBoundsMap = getVertexBounds();
|
||||
Set<Entry<V, Rectangle>> entrySet = vertexBoundsMap.entrySet();
|
||||
for (Entry<V, Rectangle> entry : entrySet) {
|
||||
|
||||
+26
-7
@@ -17,9 +17,7 @@ package ghidra.graph.viewer.layout;
|
||||
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.collections4.TransformerUtils;
|
||||
import org.apache.commons.collections4.map.TransformedMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import edu.uci.ics.jung.algorithms.layout.Layout;
|
||||
import ghidra.graph.VisualGraph;
|
||||
@@ -78,13 +76,34 @@ public class LayoutPositions<V extends VisualVertex, E extends VisualEdge<V>> {
|
||||
}
|
||||
|
||||
private void setVertexLocations(Map<V, Point2D> newVertexLocations) {
|
||||
this.vertexLocations = TransformedMap.transformedMap(newVertexLocations,
|
||||
TransformerUtils.nopTransformer(), TransformerUtils.cloneTransformer());
|
||||
|
||||
Map<V, Point2D> newMap = new HashMap<>();
|
||||
Set<Entry<V, Point2D>> entries = newVertexLocations.entrySet();
|
||||
for (Entry<V, Point2D> entry : entries) {
|
||||
V key = entry.getKey();
|
||||
Point2D value = entry.getValue();
|
||||
newMap.put(key, (Point2D) value.clone());
|
||||
}
|
||||
|
||||
this.vertexLocations = newMap;
|
||||
}
|
||||
|
||||
private void setEdgeArticulations(Map<E, List<Point2D>> newEdgeArticulations) {
|
||||
this.edgeArticulations = TransformedMap.transformedMap(newEdgeArticulations,
|
||||
TransformerUtils.nopTransformer(), TransformerUtils.cloneTransformer());
|
||||
|
||||
Map<E, List<Point2D>> newMap = new HashMap<>();
|
||||
Set<Entry<E, List<Point2D>>> entries = newEdgeArticulations.entrySet();
|
||||
for (Entry<E, List<Point2D>> entry : entries) {
|
||||
E key = entry.getKey();
|
||||
List<Point2D> value = entry.getValue();
|
||||
List<Point2D> newList = new ArrayList<>();
|
||||
for (Point2D p : value) {
|
||||
newList.add(p);
|
||||
}
|
||||
|
||||
newMap.put(key, newList);
|
||||
}
|
||||
|
||||
this.edgeArticulations = newMap;
|
||||
}
|
||||
|
||||
public Map<V, Point2D> getVertexLocations() {
|
||||
|
||||
Reference in New Issue
Block a user