本文整理汇总了Java中org.eclipse.uml2.uml.ReadVariableAction类的典型用法代码示例。如果您正苦于以下问题:Java ReadVariableAction类的具体用法?Java ReadVariableAction怎么用?Java ReadVariableAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReadVariableAction类属于org.eclipse.uml2.uml包,在下文中一共展示了ReadVariableAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testLink
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testLink() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.link_and_unlink");
Class clsA = cls(model, "A");
Property otherEnd = property(clsA, "OtherEnd", "B");
Class clsB = cls(model, "B");
Property thisEnd = property(clsB, "ThisEnd", "A");
SequenceNode body = loadActionCode(model, "A", "testLink");
SequenceNode linkStmt = node(body, 0, "link inst1 to inst2;", SequenceNode.class);
node(linkStmt, 0, "inst1", ReadVariableAction.class);
node(linkStmt, 1, "inst2", ReadVariableAction.class);
CreateLinkAction linkNode = node(linkStmt, 2, "link inst1 to inst2", CreateLinkAction.class);
assertEquals(thisEnd, linkNode.getEndData().get(0).getEnd());
assertNotNull(linkNode.getEndData().get(0).getValue());
assertEquals(otherEnd, linkNode.getEndData().get(1).getEnd());
assertNotNull(linkNode.getEndData().get(1).getValue());
}
示例2: testUnlink
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testUnlink() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.link_and_unlink");
Class clsA = cls(model, "A");
Property otherEnd = property(clsA, "OtherEnd", "B");
Class clsB = cls(model, "B");
Property thisEnd = property(clsB, "ThisEnd", "A");
SequenceNode body = loadActionCode(model, "A", "testUnlink");
SequenceNode linkStmt = node(body, 0, "unlink inst1 from inst2;", SequenceNode.class);
node(linkStmt, 0, "inst1", ReadVariableAction.class);
node(linkStmt, 1, "inst2", ReadVariableAction.class);
DestroyLinkAction linkNode = node(linkStmt, 2, "unlink inst1 from inst2", DestroyLinkAction.class);
assertEquals(thisEnd, linkNode.getEndData().get(0).getEnd());
assertNotNull(linkNode.getEndData().get(0).getValue());
assertEquals(otherEnd, linkNode.getEndData().get(1).getEnd());
assertNotNull(linkNode.getEndData().get(1).getValue());
}
示例3: testSend
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testSend() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.send");
Class clsA = cls(model, "A");
Property otherEnd = property(clsA, "B_end", "B");
Class clsB = cls(model, "B");
Property thisEnd = property(clsB, "A_end", "A");
SequenceNode body = loadActionCode(model, "A", "test");
SequenceNode sendStmt = node(body, 0, "send create Sig to select(a -> B_end);", SequenceNode.class);
node(sendStmt, 0, "create Sig", SequenceNode.class);
node(sendStmt, 1, "a", ReadVariableAction.class);
ReadLinkAction readLink = node(sendStmt, 2, "a -> B_end", ReadLinkAction.class);
node(sendStmt, 3, "select(a -> B_end)", CallOperationAction.class);
node(sendStmt, 4, "send create Sig to select(a -> B_end)", SendObjectAction.class);
assertEquals(thisEnd, readLink.getEndData().get(0).getEnd());
assertNotNull(readLink.getEndData().get(0).getValue());
assertEquals(otherEnd, readLink.getEndData().get(1).getEnd());
assertEquals(null, readLink.getEndData().get(1).getValue());
}
示例4: testSignal
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testSignal() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.signal");
Signal sig = signal(model, "Sig");
SignalEvent sigEvent = signalEvent(model, "Sig");
assertEquals(sig, sigEvent.getSignal());
Class sigFactory = cls(model, "#Sig_factory");
Operation sigCtor = operation(sigFactory, "Sig");
assertEquals(4, sigCtor.getOwnedParameters().size());
SequenceNode body = loadActionCode(model, "A", "test");
SequenceNode createNode = node(body, 0, "create Sig", SequenceNode.class);
CreateObjectAction initiateNode = node(createNode, 0, "instantiate Sig", CreateObjectAction.class);
assertEquals(sig, initiateNode.getClassifier());
node(createNode, 1, "#temp=instantiate Sig", AddVariableValueAction.class);
node(createNode, 2, "1", ValueSpecificationAction.class);
node(createNode, 3, "true", ValueSpecificationAction.class);
node(createNode, 4, "\"test\"", ValueSpecificationAction.class);
node(createNode, 5, "#temp", ReadVariableAction.class);
CallOperationAction ctorCall = node(createNode, 6, "Sig(Sig p0, Integer p1, Boolean p2, String p3)",
CallOperationAction.class);
assertEquals(sigCtor, ctorCall.getOperation());
node(createNode, 7, "#temp", ReadVariableAction.class);
}
示例5: caseAVariableAccess
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Override
public void caseAVariableAccess(AVariableAccess node) {
ReadVariableAction action = (ReadVariableAction) builder.createAction(IRepository.PACKAGE
.getReadVariableAction());
try {
super.caseAVariableAccess(node);
final OutputPin result = action.createResult(null, null);
builder.registerOutput(result);
String variableName = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
Variable variable = builder.getVariable(variableName);
ensure(variable != null, node.getIdentifier(), Severity.ERROR, () -> "Unknown local variable '" + variableName + "'");
action.setVariable(variable);
TypeUtils.copyType(variable, result, getBoundElement());
fillDebugInfo(action, node);
} finally {
builder.closeAction();
}
checkIncomings(action, node.getIdentifier(), getBoundElement());
}
示例6: testPostfixOperation
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testPostfixOperation() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.compound_ops");
SequenceNode body = loadActionCode(model, "TestClass", "test");
SequenceNode postStmtNode = (SequenceNode) body.getNode("this.fld=this.fld++;");
SequenceNode postExprNode = (SequenceNode) postStmtNode.getNode("this.fld=this.fld++");
node(postExprNode, 0, "this", ReadSelfAction.class);
node(postExprNode, 1, "this.fld", ReadStructuralFeatureAction.class);
node(postExprNode, 2, "#temp=this.fld", AddVariableValueAction.class);
node(postExprNode, 3, "this.fld", ReadStructuralFeatureAction.class);
node(postExprNode, 4, "1", ValueSpecificationAction.class);
node(postExprNode, 5, "this.fld++", CallOperationAction.class);
node(postExprNode, 6, "this.fld=this.fld++", AddStructuralFeatureValueAction.class);
node(postExprNode, 7, "#temp", ReadVariableAction.class);
}
示例7: testCreateActionBehavior
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testCreateActionBehavior() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.create_and_destroy");
SequenceNode body = loadActionCode(model, "TestClass", "testCreate");
SequenceNode createNode = (SequenceNode) body.getNode("create TestClass");
node(createNode, 0, "instantiate TestClass", CreateObjectAction.class);
node(createNode, 1, "#temp=instantiate TestClass", AddVariableValueAction.class);
node(createNode, 2, "#temp", ReadVariableAction.class);
node(createNode, 3, "1", ValueSpecificationAction.class);
node(createNode, 4, "2", ValueSpecificationAction.class);
node(createNode, 5, "#temp.TestClass(Integer p0, Integer p1)", CallOperationAction.class);
node(createNode, 6, "#temp", ReadVariableAction.class);
}
示例8: testDestroyActionBehavior
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testDestroyActionBehavior() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.create_and_destroy");
SequenceNode body = loadActionCode(model, "TestClass", "testDestroy");
SequenceNode createNode = (SequenceNode) body.getNode("delete cls;");
node(createNode, 0, "cls", ReadVariableAction.class);
node(createNode, 1, "delete cls", DestroyObjectAction.class);
}
示例9: testStart
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testStart() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.start");
SequenceNode body = loadActionCode(model, "TestClass", "test");
SequenceNode logStmt = node(body, 0, "start inst;", SequenceNode.class);
node(logStmt, 0, "inst", ReadVariableAction.class);
node(logStmt, 1, "start inst", StartObjectBehaviorAction.class);
}
示例10: testToString
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testToString() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.toString");
SequenceNode body = loadActionCode(model, "TestClass", "testToString");
SequenceNode toStringStmt = node(body, 0, "sut.toString;", SequenceNode.class);
node(toStringStmt, 0, "sut", ReadVariableAction.class);
node(toStringStmt, 1, "sut.toString", CallOperationAction.class);
}
示例11: testForEachLoop
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testForEachLoop() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.foreach_control");
SequenceNode body = loadActionCode(model, "TestClass", "test");
ExpansionRegion exp = node(body, 0, "foreach (coll)", ExpansionRegion.class);
inputElement(exp, 0, "coll_expansion");
node(exp, 0, "coll", ReadVariableAction.class);
SequenceNode inner = node(exp, 1, null, SequenceNode.class);
node(inner, 0, "this.sum=this.sum+i;", SequenceNode.class);
}
示例12: testIf
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testIf() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.if_control");
SequenceNode body = loadActionCode(model, "TestClass", "testIf");
SequenceNode ifNode = node(body, 0, "if (test)", SequenceNode.class);
node(ifNode, 0, "test", ReadVariableAction.class);
node(ifNode, 1, "#if_cond=test", AddVariableValueAction.class);
ConditionalNode condNode = node(ifNode, 2, null, ConditionalNode.class);
clauseTest(condNode, 0, "#if_cond", ReadVariableAction.class);
SequenceNode clauseBody = clauseBody(condNode, 0, null, SequenceNode.class);
node(clauseBody, 0, "Action.log(\"then\");", SequenceNode.class);
}
示例13: testIfElse
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testIfElse() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.if_control");
SequenceNode body = loadActionCode(model, "TestClass", "testIfElse");
SequenceNode ifNode = node(body, 0, "if (test)", SequenceNode.class);
node(ifNode, 0, "test", ReadVariableAction.class);
node(ifNode, 1, "#if_cond=test", AddVariableValueAction.class);
ConditionalNode condNode = node(ifNode, 2, null, ConditionalNode.class);
clauseTest(condNode, 0, "#if_cond", ReadVariableAction.class);
SequenceNode clauseBody = clauseBody(condNode, 0, null, SequenceNode.class);
node(clauseBody, 0, "Action.log(\"then\");", SequenceNode.class);
clauseTest(condNode, 1, "!#if_cond", CallOperationAction.class);
SequenceNode elseBody = clauseBody(condNode, 1, null, SequenceNode.class);
node(elseBody, 0, "Action.log(\"else\");", SequenceNode.class);
}
示例14: testInlineIf
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testInlineIf() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.if_control");
SequenceNode body = loadActionCode(model, "TestClass", "testInlineIf");
SequenceNode ifNode = node(body, 0, "if (test)", SequenceNode.class);
node(ifNode, 0, "test", ReadVariableAction.class);
node(ifNode, 1, "#if_cond=test", AddVariableValueAction.class);
ConditionalNode condNode = node(ifNode, 2, null, ConditionalNode.class);
clauseTest(condNode, 0, "#if_cond", ReadVariableAction.class);
clauseBody(condNode, 0, "Action.log(\"then\");", SequenceNode.class);
}
示例15: testInlineIfElse
import org.eclipse.uml2.uml.ReadVariableAction; //导入依赖的package包/类
@Test
public void testInlineIfElse() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.if_control");
SequenceNode body = loadActionCode(model, "TestClass", "testInlineIfElse");
SequenceNode ifNode = node(body, 0, "if (test)", SequenceNode.class);
node(ifNode, 0, "test", ReadVariableAction.class);
node(ifNode, 1, "#if_cond=test", AddVariableValueAction.class);
ConditionalNode condNode = node(ifNode, 2, null, ConditionalNode.class);
clauseTest(condNode, 0, "#if_cond", ReadVariableAction.class);
clauseBody(condNode, 0, "Action.log(\"then\");", SequenceNode.class);
clauseTest(condNode, 1, "!#if_cond", CallOperationAction.class);
clauseBody(condNode, 1, "Action.log(\"else\");", SequenceNode.class);
}