本文整理汇总了Java中org.eclipse.uml2.uml.AddVariableValueAction类的典型用法代码示例。如果您正苦于以下问题:Java AddVariableValueAction类的具体用法?Java AddVariableValueAction怎么用?Java AddVariableValueAction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AddVariableValueAction类属于org.eclipse.uml2.uml包,在下文中一共展示了AddVariableValueAction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSignal
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例2: buildReturnStatement
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
protected void buildReturnStatement(Node node) {
TemplateableElement bound = (Class) MDDUtil.getNearest(builder.getCurrentActivity(),
IRepository.PACKAGE.getClass_());
AddVariableValueAction action = (AddVariableValueAction) builder.createAction(IRepository.PACKAGE
.getAddVariableValueAction());
try {
Variable variable = builder.getReturnValueVariable();
if (variable == null) {
problemBuilder.addProblem(new ReturnValueNotExpected(), node);
throw new AbortedScopeCompilationException();
}
final InputPin value = builder.registerInput(action.createValue(null, null));
node.apply(this);
action.setVariable(variable);
TypeUtils.copyType(variable, value, bound);
fillDebugInfo(action, node);
} finally {
builder.closeAction();
}
checkIncomings(action, node, getBoundElement());
ActivityUtils.makeFinal(builder.getCurrentBlock(), action);
}
示例3: caseAWriteVariableSpecificStatement
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
@Override
public void caseAWriteVariableSpecificStatement(AWriteVariableSpecificStatement node) {
AddVariableValueAction action = (AddVariableValueAction) builder.createAction(IRepository.PACKAGE
.getAddVariableValueAction());
action.setIsReplaceAll(true);
try {
final InputPin value = builder.registerInput(action.createValue(null, null));
super.caseAWriteVariableSpecificStatement(node);
String variableName = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
Variable variable = builder.getVariable(variableName);
if (variable == null) {
problemBuilder.addError("Unknown local variable '" + variableName + "'", node.getIdentifier());
throw new AbortedStatementCompilationException();
}
action.setVariable(variable);
if (variable.getType() == null)
// infer variable type if omitted
TypeUtils.copyType(ActivityUtils.getSource(value), variable, getBoundElement());
TypeUtils.copyType(variable, value, getBoundElement());
fillDebugInfo(action, node);
} finally {
builder.closeAction();
}
checkIncomings(action, node.getIdentifier(), getBoundElement());
}
示例4: testPostfixOperation
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例5: testCreateActionBehavior
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例6: testAutoToString
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
@Test
public void testAutoToString() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.toString");
SequenceNode body = loadActionCode(model, "TestClass", "testAuto");
node(body, 0, "\"a\"", ValueSpecificationAction.class);
node(body, 1, "\"a\".toString", CallOperationAction.class);
node(body, 2, "3", ValueSpecificationAction.class);
node(body, 3, "3.toString", CallOperationAction.class);
node(body, 4, "\"a\".toString+3.toString", CallOperationAction.class);
node(body, 5, "a=\"a\".toString+3.toString", AddVariableValueAction.class);
}
示例7: testEquality
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
@Test
public void testEquality() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.equalities");
SequenceNode body = loadActionCode(model, "TestClass", "testEquality");
node(body, 0, "\"Fdf\"", ValueSpecificationAction.class);
node(body, 1, "\"Str\"", ValueSpecificationAction.class);
node(body, 2, "\"Fdf\"==\"Str\"", TestIdentityAction.class);
node(body, 3, "b=\"Fdf\"==\"Str\"", AddVariableValueAction.class);
}
示例8: testInequality
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
@Test
public void testInequality() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.equalities");
SequenceNode body = loadActionCode(model, "TestClass", "testInequality");
node(body, 0, "\"Fdf\"", ValueSpecificationAction.class);
node(body, 1, "\"Str\"", ValueSpecificationAction.class);
node(body, 2, "\"Fdf\"==\"Str\"", TestIdentityAction.class);
node(body, 3, "!\"Fdf\"==\"Str\"", CallOperationAction.class);
node(body, 4, "b=!\"Fdf\"==\"Str\"", AddVariableValueAction.class);
}
示例9: testForLoop
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
@Test
public void testForLoop() throws Exception {
Model model = model("hu.elte.txtuml.export.uml2.tests.models.for_control");
SequenceNode body = loadActionCode(model, "TestClass", "test");
LoopNode loopNode = node(body, 0, "for (i<limit) { ... }", LoopNode.class);
SequenceNode bodyNode = loopBody(loopNode, 0, null, SequenceNode.class);
node(bodyNode, 0, "this.sum=this.sum+i;", SequenceNode.class);
SequenceNode increment = loopBody(loopNode, 1, "update", SequenceNode.class);
node(increment, 0, "i=++i", SequenceNode.class);
loopCond(loopNode, "i<limit", SequenceNode.class);
SequenceNode setup = loopSetup(loopNode, "setup", SequenceNode.class);
node(setup, 0, "0", ValueSpecificationAction.class);
node(setup, 1, "i=0", AddVariableValueAction.class);
}
示例10: testIf
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例11: testIfElse
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例12: testInlineIf
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例13: testInlineIfElse
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的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);
}
示例14: checkDefaultCtor
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
protected void checkDefaultCtor(SequenceNode body) {
SequenceNode createNode = (SequenceNode) body.getNode("create DefaultConstructible;");
SequenceNode createExprNode = (SequenceNode) createNode.getNode("create DefaultConstructible");
node(createExprNode, 0, "instantiate DefaultConstructible", CreateObjectAction.class);
node(createExprNode, 1, "#temp=instantiate DefaultConstructible", AddVariableValueAction.class);
node(createExprNode, 2, "#temp", ReadVariableAction.class);
node(createExprNode, 3, "#temp.DefaultConstructible()", CallOperationAction.class);
node(createExprNode, 4, "#temp", ReadVariableAction.class);
}
示例15: checkParameteredCtor
import org.eclipse.uml2.uml.AddVariableValueAction; //导入依赖的package包/类
protected void checkParameteredCtor(SequenceNode body) {
SequenceNode createNode = (SequenceNode) body.getNode("create ClassWithCtors;");
SequenceNode createExprNode = (SequenceNode) createNode.getNode("create ClassWithCtors");
node(createExprNode, 0, "instantiate ClassWithCtors", CreateObjectAction.class);
node(createExprNode, 1, "#temp=instantiate ClassWithCtors", AddVariableValueAction.class);
node(createExprNode, 2, "#temp", ReadVariableAction.class);
node(createExprNode, 3, "1", ValueSpecificationAction.class);
node(createExprNode, 4, "#temp.ClassWithCtors(Integer p0)", CallOperationAction.class);
node(createExprNode, 5, "#temp", ReadVariableAction.class);
}