本文整理汇总了Java中vnreal.network.virtual.VirtualNode.getId方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualNode.getId方法的具体用法?Java VirtualNode.getId怎么用?Java VirtualNode.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.network.virtual.VirtualNode
的用法示例。
在下文中一共展示了VirtualNode.getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findDirectPathInVirt
import vnreal.network.virtual.VirtualNode; //导入方法依赖的package包/类
private VirtualLink findDirectPathInVirt(VirtualNode v1, VirtualNode v2,
VirtualNetwork vn, boolean direction) {
if (direction) {
return vn.findEdge(v1, v2);
} else {
for (VirtualLink vl : vn.getOutEdges(v2)) {
if (vn.getEndpoints(vl).getFirst().getId() == v1.getId()
|| vn.getEndpoints(vl).getSecond().getId() == v1
.getId()) {
return vl;
}
}
}
System.out.println("kein direkter Pfad gefunden!");
return null;
}
示例2: export
import vnreal.network.virtual.VirtualNode; //导入方法依赖的package包/类
/**
* Export a VirtualNetwork
* @param filename The file to write to
* @param snet The network to export
* @throws IOException
*/
public void export(String filename, VirtualNetwork vnet) throws IOException {
FileOutputStream outStream = new FileOutputStream(filename);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(outStream));
String firstLine = vnet.isDirected() ? "digraph" : "graph";
String edge = vnet.isDirected() ? " -> " : " -- ";
firstLine += " \"" + vnet.getLabel() + "\" {\n";
bw.write(firstLine);
for (VirtualNode vn: vnet.getVertices()) {
bw.write("\t" + vn.getId() + ";\n");
}
for (VirtualLink vl : vnet.getEdges()) {
VirtualNode n1 = vnet.getSource(vl);
VirtualNode n2 = vnet.getDest(vl);
String line = "\t" + n1.getId() + edge + n2.getId() + ";\n";
bw.write(line);
}
bw.write("}");
bw.flush();
bw.close();
}
示例3: getVnodeById
import vnreal.network.virtual.VirtualNode; //导入方法依赖的package包/类
/**
*
* @param vNet
* @param id
* @return the virtual node corresponding to the id
*/
private VirtualNode getVnodeById(VirtualNetwork vNet, int id) {
for (Iterator<VirtualNode> itt = vNet.getVertices().iterator(); itt
.hasNext();) {
VirtualNode tempVirNode = itt.next();
if (tempVirNode.getId() == id)
return tempVirNode;
}
return null;
}