com.github.rinde.rinsim.geom.Graph.hasConnection()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中com.github.rinde.rinsim.geom.Graph.hasConnection()方法的一些代码示例,展示了Graph.hasConnection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.hasConnection()方法的具体详情如下:
包路径:com.github.rinde.rinsim.geom.Graph
类名称:Graph
方法名:hasConnection

Graph.hasConnection介绍

[英]Checks if the same (as defined by Connection#equals(Object)) connection exists in this graph.
[中]检查此图中是否存在相同(由连接#等于(对象))连接定义)的连接。

代码示例

代码示例来源:origin: rinde/RinSim

@Override
public <T extends ConnectionData> boolean hasConnection(
  Connection<T> connection) {
 return delegate.hasConnection(connection);
}

代码示例来源:origin: com.github.rinde/rinsim-geom

@Override
public boolean hasConnection(Point from, Point to) {
 return delegate.hasConnection(from, to);
}

代码示例来源:origin: com.github.rinde/rinsim-geom

@Override
public <T extends ConnectionData> boolean hasConnection(
  Connection<T> connection) {
 return delegate.hasConnection(connection);
}

代码示例来源:origin: rinde/RinSim

@Override
public boolean hasConnection(Point from, Point to) {
 return delegate.hasConnection(from, to);
}

代码示例来源:origin: rinde/RinSim

void checkConnectionsExists(Point from, Point to) {
 checkArgument(graph.hasConnection(from, to),
  "There is no connection between %s and %s.", from, to);
}

代码示例来源:origin: com.github.rinde/rinsim-geom

@Nullable
MultiAttributeData getData(Graph<?> graph, Point from, Point to) {
 if (graph.hasConnection(from, to)) {
  final Connection<?> conn = graph.getConnection(from, to);
  safeToCast = lastGraph == graph && safeToCast;
  lastGraph = graph;
  if (conn.data().isPresent()
   && (safeToCast || conn.data().get() instanceof MultiAttributeData)) {
   safeToCast = true;
   return (MultiAttributeData) conn.data().get();
  }
 }
 return null;
}

代码示例来源:origin: rinde/RinSim

@Nullable
MultiAttributeData getData(Graph<?> graph, Point from, Point to) {
 if (graph.hasConnection(from, to)) {
  final Connection<?> conn = graph.getConnection(from, to);
  safeToCast = lastGraph == graph && safeToCast;
  lastGraph = graph;
  if (conn.data().isPresent()
   && (safeToCast || conn.data().get() instanceof MultiAttributeData)) {
   safeToCast = true;
   return (MultiAttributeData) conn.data().get();
  }
 }
 return null;
}

代码示例来源:origin: rinde/RinSim

} else {
 checkArgument(
  graph.hasConnection(from, to),
  "The specified points (%s and %s) must be part of an existing "
   + "connection in the graph.",

代码示例来源:origin: rinde/RinSim

private void checkAssertions(Point A, Point B, Point C, Point D) {
 // contain nodes
 assertTrue("contains A", graph.containsNode(A));
 assertTrue("contains B", graph.containsNode(B));
 assertTrue("contains C", graph.containsNode(C));
 assertTrue("contains D", graph.containsNode(D));
 assertTrue("connection A->B", graph.hasConnection(A, B));
 assertTrue("connection B->C", graph.hasConnection(B, C));
 assertTrue("connection B->D", graph.hasConnection(B, D));
 assertFalse("!connection B->A", graph.hasConnection(B, A));
 assertFalse("!connection C->B", graph.hasConnection(A, C));
 assertFalse("!connection D->B", graph.hasConnection(A, D));
 assertFalse("!connection A->C", graph.hasConnection(A, C));
 assertFalse("!connection A->D", graph.hasConnection(A, D));
}

代码示例来源:origin: rinde/RinSim

&& !graph.hasConnection(objLoc, nextHop)) {
final Connection<?> nextConn = registry().getConnection(nextHop);
checkArgument(
 graph.hasConnection(objLoc, nextConn.to()),
 "Illegal path, first point is on an connection not connected to "
  + "object location. ");

代码示例来源:origin: rinde/RinSim

@Override
protected void checkMoveValidity(Point objLoc, Point nextHop) {
 super.checkMoveValidity(objLoc, nextHop);
 // check if there is a vehicle driving in the opposite direction
 if (!objLoc.equals(nextHop)) {
  final Connection<?> conn = getConnection(objLoc, nextHop);
  if (graph.hasConnection(conn.to(), conn.from())
   && registry()
    .hasObjectOn(Connection.create(conn.to(), conn.from()))) {
   throw new DeadlockException(conn);
  }
 }
}

代码示例来源:origin: rinde/RinSim

assertTrue(graph.hasConnection(n0, n1));
assertTrue(graph.hasConnection(n0, n19663));
assertTrue(graph.hasConnection(n0, n16767));
assertTrue(graph.hasConnection(n1, n0));
assertTrue(graph.hasConnection(n1, n2));
assertTrue(graph.hasConnection(n2, n1));
assertTrue(graph.hasConnection(n2, n3));
assertTrue(graph.hasConnection(n3, n2));

代码示例来源:origin: rinde/RinSim

@Override
 public void handleEvent(Event e) {
  GraphEvent ge = (GraphEvent) e;
  if (e.getEventType() == ADD_CONNECTION) {
   assertTrue(ge.getGraph().hasConnection(ge.getConnection()));
   assertEquals(
    ge.getConnection(),
    ge.getGraph().getConnection(ge.getConnection().from(),
     ge.getConnection().to()));
  } else if (e.getEventType() == REMOVE_CONNECTION) {
   assertFalse(ge.getGraph().hasConnection(ge.getConnection().from(),
    ge.getConnection().to()));
  } else if (e.getEventType() == CHANGE_CONNECTION_DATA) {
   assertTrue(ge.getGraph().hasConnection(ge.getConnection().from(),
    ge.getConnection().to()));
   assertEquals(
    ge.getConnection().data(),
    ge.getGraph()
     .getConnection(ge.getConnection().from(),
      ge.getConnection().to())
     .data());
  }
 }
}

代码示例来源:origin: rinde/RinSim

if (!graph.hasConnection(e.to(), e.from()) && drawOneWayStreetArrows) {
 if (PointUtil.length(e) > SHORT_CONNECTION_LENGTH * vehicleLength) {
  final Point start1 = PointUtil.on(e, vehicleLength);

相关文章