当前位置: 首页>>代码示例>>Java>>正文


Java XBinaryOperation类代码示例

本文整理汇总了Java中org.eclipse.xtext.xbase.XBinaryOperation的典型用法代码示例。如果您正苦于以下问题:Java XBinaryOperation类的具体用法?Java XBinaryOperation怎么用?Java XBinaryOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XBinaryOperation类属于org.eclipse.xtext.xbase包,在下文中一共展示了XBinaryOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkOperandTypesForTripleEquals

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
@Check
public void checkOperandTypesForTripleEquals(XBinaryOperation binaryOperation) {
	if(isTripleEqualsOperation(binaryOperation)){
		LightweightTypeReference left = getActualType(binaryOperation.getLeftOperand());
		LightweightTypeReference right = getActualType(binaryOperation.getRightOperand());
		if(left.isArray() != right.isArray()) {
			if (left.isArray()) {
				if (right.isAny() || right.isType(Object.class) || right.isType(Serializable.class) || right.isType(Cloneable.class)) {
					return;
				}
			} else {
				if (left.isAny() || left.isType(Object.class) || left.isType(Serializable.class) || left.isType(Cloneable.class)) {
					return;
				}
			}
			error("Incompatible operand types " + left.getHumanReadableName() + " and " + right.getHumanReadableName(), null, INVALID_OPERAND_TYPES);
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:XbaseValidator.java

示例2: getSyntacticReceiver

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
public XExpression getSyntacticReceiver(XExpression expression) {
	if (expression instanceof XAbstractFeatureCall) {
		if (expression instanceof XFeatureCall) {
			return null;
		}
		if (expression instanceof XMemberFeatureCall) {
			return ((XMemberFeatureCall) expression).getMemberCallTarget();
		}
		if (expression instanceof XAssignment) {
			return ((XAssignment) expression).getAssignable();
		}
		if (expression instanceof XBinaryOperation) {
			return ((XBinaryOperation) expression).getLeftOperand();
		}
		if (expression instanceof XUnaryOperation) {
			return ((XUnaryOperation) expression).getOperand();
		}
		if (expression instanceof XPostfixOperation) {
			return ((XPostfixOperation) expression).getOperand();
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:24,代码来源:FeatureLinkHelper.java

示例3: getSyntacticArguments

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
public List<XExpression> getSyntacticArguments(XAbstractFeatureCall expression) {
	if (expression instanceof XFeatureCall) {
		return ((XFeatureCall) expression).getFeatureCallArguments();
	}
	if (expression instanceof XMemberFeatureCall) {
		return ((XMemberFeatureCall) expression).getMemberCallArguments();
	}
	if (expression instanceof XAssignment) {
		return Collections.singletonList(((XAssignment) expression).getValue());
	}
	if (expression instanceof XBinaryOperation) {
		return Collections.singletonList(((XBinaryOperation) expression).getRightOperand());
	}
	// explicit condition to make sure we thought about it
	if (expression instanceof XUnaryOperation) {
		return Collections.emptyList();
	}
	if (expression instanceof XPostfixOperation) {
		return Collections.emptyList();
	}
	return Collections.emptyList();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:23,代码来源:FeatureLinkHelper.java

示例4: internalEvaluate

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
public Object internalEvaluate(final XExpression it, final Context ctx) {
  if (it instanceof XBinaryOperation) {
    return _internalEvaluate((XBinaryOperation)it, ctx);
  } else if (it instanceof XUnaryOperation) {
    return _internalEvaluate((XUnaryOperation)it, ctx);
  } else if (it instanceof XBooleanLiteral) {
    return _internalEvaluate((XBooleanLiteral)it, ctx);
  } else if (it instanceof XCastedExpression) {
    return _internalEvaluate((XCastedExpression)it, ctx);
  } else if (it instanceof XStringLiteral) {
    return _internalEvaluate((XStringLiteral)it, ctx);
  } else if (it instanceof XTypeLiteral) {
    return _internalEvaluate((XTypeLiteral)it, ctx);
  } else if (it instanceof XAnnotation) {
    return _internalEvaluate((XAnnotation)it, ctx);
  } else if (it != null) {
    return _internalEvaluate(it, ctx);
  } else if (it == null) {
    return _internalEvaluate((Void)null, ctx);
  } else {
    throw new IllegalArgumentException("Unhandled parameter types: " +
      Arrays.<Object>asList(it, ctx).toString());
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:25,代码来源:AbstractConstantExpressionsInterpreter.java

示例5: checkAssignment

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
@Check
public void checkAssignment(XBinaryOperation binaryOperation) {
	if (binaryOperation.isReassignFirstArgument()) {
		XExpression leftOperand = binaryOperation.getLeftOperand();
		checkAssignment(leftOperand, false);
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:XbaseValidator.java

示例6: isReassignFirstArgument

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
protected boolean isReassignFirstArgument(XAbstractFeatureCall featureCall) {
	if (featureCall instanceof XBinaryOperation) {
		XBinaryOperation binaryOperation = (XBinaryOperation) featureCall;
		return binaryOperation.isReassignFirstArgument();	
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:FeatureLinkingCandidate.java

示例7: isOperationCallSyntax

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
protected boolean isOperationCallSyntax() {
	XAbstractFeatureCall featureCall = getFeatureCall();
	if (featureCall instanceof XBinaryOperation || featureCall instanceof XAssignment) {
		return false;
	}
	return featureCall.isExplicitOperationCallOrBuilderSyntax();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:FeatureLinkingCandidate.java

示例8: isCompoundOperator

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
protected boolean isCompoundOperator() {
	if (!(getFeatureCall() instanceof XBinaryOperation)) {
		return false;
	}
	String methodName = getFeature().getSimpleName();
	return getState().getReferenceOwner().getServices().getOperatorMapping().isCompoundMethod(methodName);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:8,代码来源:FeatureLinkingCandidate.java

示例9: getSyntaxDescriptions

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
@Override
protected String getSyntaxDescriptions() {
	XExpression expression = getExpression();
	if (expression instanceof XBinaryOperation) {
		return "binary operation";
	} else if (expression instanceof XUnaryOperation) {
		return "unary operation";
	} else if (expression instanceof XPostfixOperation) {
		return "postfix operation";
	} else {
		return "feature call";
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:AmbiguousFeatureLinkingCandidate.java

示例10: validateTypeArgumentConformance

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
protected boolean validateTypeArgumentConformance(IAcceptor<? super AbstractDiagnostic> result) {
	if (getTypeArgumentConformanceFailures(result) == 0) {
		// TODO use early exit computation
		List<XExpression> arguments = getSyntacticArguments();
		for(int i = 0; i < arguments.size(); i++) {
			XExpression argument = arguments.get(i);
			if (isDefiniteEarlyExit(argument)) {
				XExpression errorOn = getExpression();
				String message = "Unreachable code.";
				EStructuralFeature errorFeature = null;
				if (i < arguments.size() - 1) {
					errorOn = arguments.get(i + 1);
				} else {
					errorFeature = getDefaultValidationFeature();
					if (errorOn instanceof XBinaryOperation) {
						message = "Unreachable code. The right argument expression does not complete normally.";
					} else {
						message = "Unreachable code. The last argument expression does not complete normally.";
					}
				}
				AbstractDiagnostic diagnostic = new EObjectDiagnosticImpl(
						Severity.ERROR, 
						IssueCodes.UNREACHABLE_CODE, 
						message, 
						errorOn, 
						errorFeature, 
						-1, null);
				result.accept(diagnostic);
				return false;
			}
		}
	} else {
		return false;
	}
	return true;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:37,代码来源:AbstractPendingLinkingCandidate.java

示例11: startsWithUnaryOperator

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
protected boolean startsWithUnaryOperator(EObject obj) {
	if(obj instanceof XUnaryOperation)
		return true;
	if(obj instanceof XBinaryOperation)
		return startsWithUnaryOperator(((XBinaryOperation)obj).getLeftOperand());
	if(obj instanceof XPostfixOperation) {
		return startsWithUnaryOperator(((XPostfixOperation)obj).getOperand());
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:XbaseSyntacticSequencer.java

示例12: getOperator

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
protected QualifiedName getOperator(XAbstractFeatureCall call, QualifiedName name) {
	QualifiedName operator = operatorMapping.getOperator(name);
	if (!(call instanceof XBinaryOperation)) {
		return operator;
	}
	XBinaryOperation binaryOperation = (XBinaryOperation) call;
	if (!binaryOperation.isReassignFirstArgument()) {
		return operator;
	}
	if (operatorMapping.getCompoundOperators().contains(operator)) {
		return operator;
	}
	return operatorMapping.getCompoundOperator(operator);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:SerializerScopeProvider.java

示例13: getScope

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
@Override
public IScope getScope(EObject context, EReference reference) {
	if (context == null || context.eResource() == null || context.eResource().getResourceSet() == null) {
		return IScope.NULLSCOPE;
	}
	if (isFeatureCallScope(reference)) {
		IExpressionScope.Anchor anchor = IExpressionScope.Anchor.BEFORE;
		if (context instanceof XAbstractFeatureCall) {
			EObject proxyOrResolved = (EObject) context.eGet(reference, false);
			if (proxyOrResolved != null && !proxyOrResolved.eIsProxy()) {
				XExpression receiver = ((XAbstractFeatureCall) context).getActualReceiver();
				if (receiver == null && context instanceof XMemberFeatureCall) {
					receiver = ((XMemberFeatureCall) context).getMemberCallTarget();
				}
				if (receiver != null) {
					anchor = IExpressionScope.Anchor.RECEIVER;
					context = receiver;
				}
			} else if (context instanceof XBinaryOperation) {
				context = ((XBinaryOperation) context).getLeftOperand();
				anchor = IExpressionScope.Anchor.RECEIVER;
			} else if (context instanceof XMemberFeatureCall) {
				context = ((XMemberFeatureCall) context).getMemberCallTarget();
				anchor = IExpressionScope.Anchor.RECEIVER;
			}
		}
		IExpressionScope expressionScope = typeResolver.resolveTypes(context).getExpressionScope(context, anchor);
		return expressionScope.getFeatureScope();
	}
	if (isTypeScope(reference)) {
		return typeScopes.createTypeScope(context, reference);
	}
	return delegateGetScope(context, reference);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:35,代码来源:XbaseBatchScopeProvider.java

示例14: hasSideEffects

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
public boolean hasSideEffects(XAbstractFeatureCall featureCall, boolean inspectContents) {
	if (featureCall instanceof XBinaryOperation) {
		XBinaryOperation binaryOperation = (XBinaryOperation) featureCall;
		if (binaryOperation.isReassignFirstArgument()) {
			return true;
		}
	}
	if (featureCall instanceof XAssignment) {
		return true;
	}
	if (featureCall.isPackageFragment() || featureCall.isTypeLiteral()) {
		return false;
	}
	final JvmIdentifiableElement feature = featureCall.getFeature();
	if (feature == null || feature.eIsProxy())
		return true; // linking problems ... could be anything
	if (feature instanceof JvmConstructor) { //super() and this()
		return true;
	}
	if (feature instanceof JvmOperation) {
		JvmOperation jvmOperation = (JvmOperation) feature;
		if (findPureAnnotation(jvmOperation) == null) {
			return true;
		} else {
			if(inspectContents) {
				for (XExpression param : featureCall.getActualArguments()) {
					if (hasSideEffects(param))
						return true;
				}
			}
		}
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:35,代码来源:XExpressionHelper.java

示例15: isShortCircuitOperation

import org.eclipse.xtext.xbase.XBinaryOperation; //导入依赖的package包/类
public boolean isShortCircuitOperation(XAbstractFeatureCall featureCall) {
	if (featureCall instanceof XBinaryOperation) {
		if (isOperatorFromExtension(featureCall, OperatorMapping.ELVIS, ObjectExtensions.class))
			return true;
		else 
			return isBooleanAndOrOr(featureCall);
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:10,代码来源:XExpressionHelper.java


注:本文中的org.eclipse.xtext.xbase.XBinaryOperation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。