本文整理匯總了Java中org.manifold.compiler.middle.Schematic.getNodeName方法的典型用法代碼示例。如果您正苦於以下問題:Java Schematic.getNodeName方法的具體用法?Java Schematic.getNodeName怎麽用?Java Schematic.getNodeName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.manifold.compiler.middle.Schematic
的用法示例。
在下文中一共展示了Schematic.getNodeName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testGetNodeName
import org.manifold.compiler.middle.Schematic; //導入方法依賴的package包/類
@Test
public void testGetNodeName()
throws SchematicException {
Schematic sch = new Schematic("test");
// create a test node type
String nodeTypeName = "TestNode";
Map<String, PortTypeValue> ports = new HashMap<>();
NodeTypeValue nodeType = new NodeTypeValue(attributes, ports);
sch.addNodeType(nodeTypeName, nodeType);
// create a node based on this type
String nodeName = "testNode";
Map<String, Value> nodeAttrs = new HashMap<>();
Map<String, Map<String, Value>> nodePortAttrs = new HashMap<>();
NodeValue node1 = new NodeValue(nodeType, nodeAttrs, nodePortAttrs);
sch.addNode(nodeName, node1);
String retrievedNodeName = sch.getNodeName(node1);
assertEquals(nodeName, retrievedNodeName);
}
示例2: testGetNodeName_Undeclared_ThrowsException
import org.manifold.compiler.middle.Schematic; //導入方法依賴的package包/類
@Test(expected = NoSuchElementException.class)
public void testGetNodeName_Undeclared_ThrowsException()
throws NoSuchElementException, SchematicException {
Schematic sch = new Schematic("test");
// create a test node type
String nodeTypeName = "TestNode";
Map<String, PortTypeValue> ports = new HashMap<>();
NodeTypeValue nodeType = new NodeTypeValue(attributes, ports);
sch.addNodeType(nodeTypeName, nodeType);
// create a node based on this type
String nodeName = "testNode";
Map<String, Value> nodeAttrs = new HashMap<>();
Map<String, Map<String, Value>> nodePortAttrs = new HashMap<>();
NodeValue node1 = new NodeValue(nodeType, nodeAttrs, nodePortAttrs);
// don't add this node to the schematic, but instead try to get its name
String retrievedName = sch.getNodeName(node1);
}