本文整理匯總了Java中org.manifold.compiler.StringTypeValue類的典型用法代碼示例。如果您正苦於以下問題:Java StringTypeValue類的具體用法?Java StringTypeValue怎麽用?Java StringTypeValue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StringTypeValue類屬於org.manifold.compiler包,在下文中一共展示了StringTypeValue類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAddSubExpressionGraph_correctGraphAdded
import org.manifold.compiler.StringTypeValue; //導入依賴的package包/類
@Test
public void testAddSubExpressionGraph_correctGraphAdded() throws Exception {
// init main graph
ExpressionGraph mainGraph = new ExpressionGraph();
// input/output
VariableIdentifier mainInput = new VariableIdentifier(ImmutableList.of("mainInput"));
VariableIdentifier mainOutput = new VariableIdentifier(ImmutableList.of("mainOutput"));
mainGraph.addVertex(mainInput);
mainGraph.addVertex(mainOutput);
ExpressionVertex mainInputVertex = mainGraph.getVariableVertex(mainInput);
ExpressionVertex mainOutputVertex = mainGraph.getVariableVertex(mainOutput);
// dummy vertex to remove
ExpressionVertex dummyVertex = new ConstantValueVertex(mainGraph,
new StringValue(StringTypeValue.getInstance(), "yo"));
ExpressionEdge inputEdge = new ExpressionEdge(mainInputVertex, dummyVertex);
ExpressionEdge outputEdge = new ExpressionEdge(dummyVertex, mainOutputVertex);
mainGraph.addVertex(dummyVertex);
mainGraph.addEdge(inputEdge);
mainGraph.addEdge(outputEdge);
// init subgraph
ExpressionGraph subGraph = new ExpressionGraph();
// input/output
VariableIdentifier subInput = new VariableIdentifier(ImmutableList.of("subInput"));
subGraph.addVertex(subInput);
ExpressionVertex subInputEdgeVertex = subGraph.getVariableVertex(subInput);
ExpressionEdge subGraphInputEdge = new ExpressionEdge(null, subInputEdgeVertex);
subGraph.addEdge(subGraphInputEdge);
VariableIdentifier dummyReturn = new VariableIdentifier(ImmutableList.of("returnValue"));
subGraph.addVertex(dummyReturn);
ExpressionVertex dummyReturnVertex = subGraph.getVariableVertex(dummyReturn);
ExpressionEdge returnEdge = new ExpressionEdge(dummyReturnVertex, null);
subGraph.addEdge(returnEdge);
TupleValueVertex subInputVertex = new TupleValueVertex(subGraph,
new MappedArray<>(ImmutableMap.of("a", subGraphInputEdge)));
TupleValueVertex subOutputVertex = new TupleValueVertex(subGraph,
new MappedArray<>(ImmutableMap.of("a", returnEdge)));
subGraph.addVertex(subInputVertex);
subGraph.addVertex(subOutputVertex);
// intermediate nodes
ExpressionVertex intermediate1 = new ConstantValueVertex(subGraph, BooleanValue.getInstance(true));
ExpressionVertex intermediate2 = new ConstantValueVertex(subGraph, BooleanValue.getInstance(false));
subGraph.addVertex(intermediate1);
subGraph.addVertex(intermediate2);
subGraph.addEdge(new ExpressionEdge(subInputVertex, intermediate1));
subGraph.addEdge(new ExpressionEdge(subInputVertex, intermediate2));
subGraph.addEdge(new ExpressionEdge(intermediate1, subOutputVertex));
subGraph.addEdge(new ExpressionEdge(intermediate2, subOutputVertex));
mainGraph.writeDOTFile(new File("build/mainGraph.txt"));
subGraph.writeDOTFile(new File("build/subGraph.txt"));
Map<VariableReferenceVertex, VariableReferenceVertex> dontRename = new HashMap<>();
mainGraph.addFunctionExpressionGraph(subGraph, inputEdge, subInputVertex, outputEdge, subOutputVertex, dontRename);
mainGraph.writeDOTFile(new File("build/merged.txt"));
}