本文整理匯總了Java中org.eclipse.gemoc.gexpressions.GAdditionExpression類的典型用法代碼示例。如果您正苦於以下問題:Java GAdditionExpression類的具體用法?Java GAdditionExpression怎麽用?Java GAdditionExpression使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GAdditionExpression類屬於org.eclipse.gemoc.gexpressions包,在下文中一共展示了GAdditionExpression類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: caseGAdditionExpression
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
@Override
public Object caseGAdditionExpression(GAdditionExpression object) {
Object op1 = this.doSwitch(object.getLeftOperand());
Object op2 = this.doSwitch(object.getRightOperand());
switch (object.getOperator()) {
case ADDITION:
return addition(op1, op2);
case SUBTRACTION:
return subtraction(op1, op2);
default:
throw new UnsupportedOperationException(
"Could not determine the type of the operator: "
+ object.getOperator());
}
}
示例2: main
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
public static void main(String[] args) {
// Getting the serializer
GExpressionsStandaloneSetup setup = new GExpressionsStandaloneSetup();
Injector injector = setup.createInjectorAndDoEMFRegistration();
Serializer serializer = injector.getInstance(Serializer.class);
// Creating a model
GexpressionsFactory factory = GexpressionsFactory.eINSTANCE;
GAdditionExpression exp = factory.createGAdditionExpression();
GIntegerExpression un = factory.createGIntegerExpression();
un.setValue(1);
GStringExpression deux = factory.createGStringExpression();
deux.setValue("deux");
exp.setLeftOperand(un);
exp.setRightOperand(deux);
// Serializing
String s = serializer.serialize(exp);
System.out.println(s);
}
示例3: getText
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
GAdditionOperator labelValue = ((GAdditionExpression)object).getOperator();
String label = labelValue == null ? null : labelValue.toString();
return label == null || label.length() == 0 ?
getString("_UI_GAdditionExpression_type") :
getString("_UI_GAdditionExpression_type") + " " + label;
}
示例4: notifyChanged
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(GAdditionExpression.class)) {
case GexpressionsPackage.GADDITION_EXPRESSION__OPERATOR:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
示例5: sequence
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == GexpressionsPackage.eINSTANCE)
switch (semanticObject.eClass().getClassifierID()) {
case GexpressionsPackage.GADDITION_EXPRESSION:
sequence_GAdditionExpression(context, (GAdditionExpression) semanticObject);
return;
case GexpressionsPackage.GAND_EXPRESSION:
sequence_GAndExpression(context, (GAndExpression) semanticObject);
return;
case GexpressionsPackage.GBOOLEAN_EXPRESSION:
sequence_GBooleanExpression(context, (GBooleanExpression) semanticObject);
return;
case GexpressionsPackage.GBRACE_EXPRESSION:
sequence_GBraceExpression(context, (GBraceExpression) semanticObject);
return;
case GexpressionsPackage.GDOUBLE_EXPRESSION:
sequence_GDoubleExpression(context, (GDoubleExpression) semanticObject);
return;
case GexpressionsPackage.GENUM_LITERAL_EXPRESSION:
sequence_GEnumLiteralExpression(context, (GEnumLiteralExpression) semanticObject);
return;
case GexpressionsPackage.GEQUALITY_EXPRESSION:
sequence_GEqualityExpression(context, (GEqualityExpression) semanticObject);
return;
case GexpressionsPackage.GIF_EXPRESSION:
sequence_GIfExpression(context, (GIfExpression) semanticObject);
return;
case GexpressionsPackage.GIMPORT_STATEMENT:
sequence_GImportStatement(context, (GImportStatement) semanticObject);
return;
case GexpressionsPackage.GINTEGER_EXPRESSION:
sequence_GIntegerExpression(context, (GIntegerExpression) semanticObject);
return;
case GexpressionsPackage.GMULTIPLICATION_EXPRESSION:
sequence_GMultiplicationExpression(context, (GMultiplicationExpression) semanticObject);
return;
case GexpressionsPackage.GNAVIGATION_EXPRESSION:
sequence_GNavigationExpression(context, (GNavigationExpression) semanticObject);
return;
case GexpressionsPackage.GNEGATION_EXPRESSION:
sequence_GNegationExpression(context, (GNegationExpression) semanticObject);
return;
case GexpressionsPackage.GOR_EXPRESSION:
sequence_GOrExpression(context, (GOrExpression) semanticObject);
return;
case GexpressionsPackage.GPROGRAM:
sequence_GProgram(context, (GProgram) semanticObject);
return;
case GexpressionsPackage.GREFERENCE_EXPRESSION:
sequence_GReferenceExpression(context, (GReferenceExpression) semanticObject);
return;
case GexpressionsPackage.GRELATION_EXPRESSION:
sequence_GRelationExpression(context, (GRelationExpression) semanticObject);
return;
case GexpressionsPackage.GSTRING_EXPRESSION:
sequence_GStringExpression(context, (GStringExpression) semanticObject);
return;
case GexpressionsPackage.GXOR_EXPRESSION:
sequence_GXorExpression(context, (GXorExpression) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
示例6: sequence_GAdditionExpression
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
/**
* Contexts:
* GExpression returns GAdditionExpression
* GOrExpression returns GAdditionExpression
* GOrExpression.GOrExpression_1_0 returns GAdditionExpression
* GXorExpression returns GAdditionExpression
* GXorExpression.GXorExpression_1_0 returns GAdditionExpression
* GAndExpression returns GAdditionExpression
* GAndExpression.GAndExpression_1_0 returns GAdditionExpression
* GEqualityExpression returns GAdditionExpression
* GEqualityExpression.GEqualityExpression_1_0 returns GAdditionExpression
* GRelationExpression returns GAdditionExpression
* GRelationExpression.GRelationExpression_1_0 returns GAdditionExpression
* GAdditionExpression returns GAdditionExpression
* GAdditionExpression.GAdditionExpression_1_0 returns GAdditionExpression
*
* Constraint:
* (leftOperand=GAdditionExpression_GAdditionExpression_1_0 operator=GAdditionOperator rightOperand=GMultiplicationExpression)
*/
protected void sequence_GAdditionExpression(ISerializationContext context, GAdditionExpression semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, GexpressionsPackage.Literals.GBINARY_OPERATOR_EXPRESSION__LEFT_OPERAND) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GexpressionsPackage.Literals.GBINARY_OPERATOR_EXPRESSION__LEFT_OPERAND));
if (transientValues.isValueTransient(semanticObject, GexpressionsPackage.Literals.GADDITION_EXPRESSION__OPERATOR) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GexpressionsPackage.Literals.GADDITION_EXPRESSION__OPERATOR));
if (transientValues.isValueTransient(semanticObject, GexpressionsPackage.Literals.GBINARY_OPERATOR_EXPRESSION__RIGHT_OPERAND) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, GexpressionsPackage.Literals.GBINARY_OPERATOR_EXPRESSION__RIGHT_OPERAND));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getGAdditionExpressionAccess().getGAdditionExpressionLeftOperandAction_1_0(), semanticObject.getLeftOperand());
feeder.accept(grammarAccess.getGAdditionExpressionAccess().getOperatorGAdditionOperatorEnumRuleCall_1_1_0(), semanticObject.getOperator());
feeder.accept(grammarAccess.getGAdditionExpressionAccess().getRightOperandGMultiplicationExpressionParserRuleCall_1_2_0(), semanticObject.getRightOperand());
feeder.finish();
}
示例7: getFixture
import org.eclipse.gemoc.gexpressions.GAdditionExpression; //導入依賴的package包/類
/**
* Returns the fixture for this GAddition Expression test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected GAdditionExpression getFixture() {
return (GAdditionExpression)fixture;
}