本文整理了Java中com.github.rinde.rinsim.geom.Graph.getNodes()
方法的一些代码示例,展示了Graph.getNodes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getNodes()
方法的具体详情如下:
包路径:com.github.rinde.rinsim.geom.Graph
类名称:Graph
方法名:getNodes
暂无
代码示例来源:origin: rinde/RinSim
@Override
public Set<Point> getNodes() {
return delegate.getNodes();
}
代码示例来源:origin: com.github.rinde/rinsim-geom
@Override
public Set<Point> getNodes() {
return delegate.getNodes();
}
代码示例来源:origin: com.github.rinde/rinsim-geom
@Override
public Set<Point> getNodes() {
return Collections.unmodifiableSet(delegate.getNodes());
}
代码示例来源:origin: rinde/RinSim
@Override
public Set<Point> getNodes() {
return Collections.unmodifiableSet(delegate.getNodes());
}
代码示例来源:origin: com.github.rinde/rinsim-example
static ImmutableList<Point> getBorderNodes(Graph<?> g) {
final Set<Point> points = g.getNodes();
double xMin = Double.MAX_VALUE;
double yMin = Double.MAX_VALUE;
double xMax = Double.MIN_VALUE;
double yMax = Double.MIN_VALUE;
for (final Point p : points) {
xMin = Math.min(xMin, p.x);
yMin = Math.min(yMin, p.y);
xMax = Math.max(xMax, p.x);
yMax = Math.max(yMax, p.y);
}
final ImmutableList.Builder<Point> builder = ImmutableList.builder();
for (final Point p : points) {
if (p.x == xMin || p.x == xMax || p.y == yMin || p.y == yMax) {
builder.add(p);
}
}
return builder.build();
}
代码示例来源:origin: rinde/RinSim
static ImmutableList<Point> getBorderNodes(Graph<?> g) {
final Set<Point> points = g.getNodes();
double xMin = Double.MAX_VALUE;
double yMin = Double.MAX_VALUE;
double xMax = Double.MIN_VALUE;
double yMax = Double.MIN_VALUE;
for (final Point p : points) {
xMin = Math.min(xMin, p.x);
yMin = Math.min(yMin, p.y);
xMax = Math.max(xMax, p.x);
yMax = Math.max(yMax, p.y);
}
final ImmutableList.Builder<Point> builder = ImmutableList.builder();
for (final Point p : points) {
if (p.x == xMin || p.x == xMax || p.y == yMin || p.y == yMax) {
builder.add(p);
}
}
return builder.build();
}
代码示例来源:origin: com.github.rinde/rinsim-geom
/**
* Calculates the extremes of the graph.
* @param graph The graph.
* @return A list containing two points, the first point contains the min x
* and min y, the second point contains the max x and max y.
*/
public static ImmutableList<Point> getExtremes(Graph<?> graph) {
final Collection<Point> nodes = graph.getNodes();
double minX = Double.POSITIVE_INFINITY;
double maxX = Double.NEGATIVE_INFINITY;
double minY = Double.POSITIVE_INFINITY;
double maxY = Double.NEGATIVE_INFINITY;
for (final Point p : nodes) {
minX = Math.min(minX, p.x);
maxX = Math.max(maxX, p.x);
minY = Math.min(minY, p.y);
maxY = Math.max(maxY, p.y);
}
return ImmutableList.of(new Point(minX, minY), new Point(maxX, maxY));
}
代码示例来源:origin: rinde/RinSim
/**
* Calculates the extremes of the graph.
* @param graph The graph.
* @return A list containing two points, the first point contains the min x
* and min y, the second point contains the max x and max y.
*/
public static ImmutableList<Point> getExtremes(Graph<?> graph) {
final Collection<Point> nodes = graph.getNodes();
double minX = Double.POSITIVE_INFINITY;
double maxX = Double.NEGATIVE_INFINITY;
double minY = Double.POSITIVE_INFINITY;
double maxY = Double.NEGATIVE_INFINITY;
for (final Point p : nodes) {
minX = Math.min(minX, p.x);
maxX = Math.max(maxX, p.x);
minY = Math.min(minY, p.y);
maxY = Math.max(maxY, p.y);
}
return ImmutableList.of(new Point(minX, minY), new Point(maxX, maxY));
}
代码示例来源:origin: rinde/RinSim
for (final Point p : graph.getNodes()) {
string.append(NODE_PREFIX)
.append(nodeId)
代码示例来源:origin: com.github.rinde/rinsim-geom
for (final Point p : graph.getNodes()) {
string.append(NODE_PREFIX)
.append(nodeId)
代码示例来源:origin: rinde/RinSim
@Override
public void doSetUp() {
model = supplier.build(mock(DependencyProvider.class));
graph = model.graph;
// graph.addConnection(SW, SE);
// graph.addConnection(SE, NE);
// graph.addConnection(NE, NW);
final Set<Point> points = graph.getNodes();
assertEquals(4, points.size());
assertTrue(points.contains(SW));
assertTrue(points.contains(SE));
assertTrue(points.contains(NE));
assertEquals(3, graph.getNumberOfConnections());
assertEquals(4, graph.getNumberOfNodes());
}
代码示例来源:origin: rinde/RinSim
private void drawNodes() {
for (final Point p : graph.getNodes()) {
if (showNodes) {
adapter.setBackgroundSysCol(SWT.COLOR_RED);
代码示例来源:origin: rinde/RinSim
for (final Point node : graph.getNodes()) {
helper.setBackgroundSysCol(SWT.COLOR_RED);
helper.fillCircle(node, NODE_RADIUS);
for (final Point node : graph.getNodes()) {
helper.setForegroundSysCol(SWT.COLOR_GRAY);
helper.drawString(node.toString(), node, true,
代码示例来源:origin: rinde/RinSim
@Test
public void removeNode() {
final Point N = new Point(0, 5);
final Point E = new Point(5, 0);
final Point S = new Point(0, -5);
final Point W = new Point(-5, 0);
Graphs.addBiPath(graph, N, E, S, W, N);
final Graph<LengthData> unmod = Graphs.unmodifiableGraph(graph);
assertEquals(graph, unmod);
assertEquals(4, graph.getNodes().size());
assertEquals(8, graph.getConnections().size());
graph.removeNode(N);
assertEquals(graph, unmod);
assertEquals(3, graph.getNodes().size());
assertEquals(4, graph.getConnections().size());
}
代码示例来源:origin: rinde/RinSim
final Point n16767 = new Point(3296661.5525598335, 2.5725117255271256E7);
assertEquals(6, graph.getNodes().size());
assertTrue(graph.containsNode(n0));
assertTrue(graph.containsNode(n1));
代码示例来源:origin: rinde/RinSim
@Test
public void unmodifiable() {
final Point N = new Point(0, 5);
final Point E = new Point(5, 0);
final Point S = new Point(0, -5);
final Point W = new Point(-5, 0);
Graphs.addBiPath(graph, N, E, S, W, N);
final Graph<LengthData> g = Graphs.unmodifiableGraph(graph);
g.hashCode();
assertEquals(graph, g);
assertEquals(g, graph);
assertFalse(g.equals(new Object()));
assertFalse(g.isEmpty());
for (final Point p : g.getNodes()) {
assertArrayEquals(graph.getIncomingConnections(p).toArray(), g
.getIncomingConnections(p).toArray());
}
for (final Connection<LengthData> c : g.getConnections()) {
assertEquals(graph.connectionLength(c.from(), c.to()),
g.connectionLength(c.from(), c.to()), DELTA);
}
}
代码示例来源:origin: rinde/RinSim
.build());
final Set<Point> points = graph.getNodes();
assertEquals(5, points.size());
assertTrue(points.contains(A));
内容来源于网络,如有侵权,请联系作者删除!