• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java XExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setDefault

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setDefault(XExpression newDefault)
{
	if (newDefault != default_)
	{
		NotificationChain msgs = null;
		if (default_ != null)
			msgs = ((InternalEObject)default_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XSWITCH_EXPRESSION__DEFAULT, null, msgs);
		if (newDefault != null)
			msgs = ((InternalEObject)newDefault).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XSWITCH_EXPRESSION__DEFAULT, null, msgs);
		msgs = basicSetDefault(newDefault, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XSWITCH_EXPRESSION__DEFAULT, newDefault, newDefault));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:XSwitchExpressionImpl.java


示例2: setNewValue

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setNewValue(XExpression newNewValue)
{
	if (newNewValue != newValue)
	{
		NotificationChain msgs = null;
		if (newValue != null)
			msgs = ((InternalEObject)newValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CheckcfgPackage.CONFIGURED_PARAMETER__NEW_VALUE, null, msgs);
		if (newNewValue != null)
			msgs = ((InternalEObject)newNewValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CheckcfgPackage.CONFIGURED_PARAMETER__NEW_VALUE, null, msgs);
		msgs = basicSetNewValue(newNewValue, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, CheckcfgPackage.CONFIGURED_PARAMETER__NEW_VALUE, newNewValue, newNewValue));
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:21,代码来源:ConfiguredParameterImpl.java


示例3: setImplicitReceiver

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setImplicitReceiver(XExpression newImplicitReceiver)
{
	if (newImplicitReceiver != implicitReceiver)
	{
		NotificationChain msgs = null;
		if (implicitReceiver != null)
			msgs = ((InternalEObject)implicitReceiver).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_FEATURE_CALL__IMPLICIT_RECEIVER, null, msgs);
		if (newImplicitReceiver != null)
			msgs = ((InternalEObject)newImplicitReceiver).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XABSTRACT_FEATURE_CALL__IMPLICIT_RECEIVER, null, msgs);
		msgs = basicSetImplicitReceiver(newImplicitReceiver, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XABSTRACT_FEATURE_CALL__IMPLICIT_RECEIVER, newImplicitReceiver, newImplicitReceiver));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:XAbstractFeatureCallImpl.java


示例4: isPossibleFunctionType

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * Returns false if the argument expression is a lambda and the expected type
 * of the argument is not a function type or {@link Object}.
 * Returns true in all other cases.
 * 
 * This serves as a shortcut to rule out decision path's where a method is overloaded
 * and one of the overloads accepts a function type but the other doesn't. In those cases
 * it is not necessary to compute the type of the lamdba expression twice.
 * 
 * An example for this pattern is {@link IterableExtensions#filter(Iterable, Class)} vs
 * {@link IterableExtensions#filter(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1)}.
 */
protected boolean isPossibleFunctionType(int idx) {
	if (idx < arguments.getArgumentCount()) {
		XExpression argument = arguments.getArgument(idx);
		if (argument instanceof XClosure) {
			XClosure closure = (XClosure) argument;
			LightweightTypeReference declaredType = arguments.getDeclaredTypeForLambda(idx);
			if (declaredType != null && !declaredType.isType(Object.class)) {
				CommonTypeComputationServices services = getState().getReferenceOwner().getServices();
				JvmOperation operation = services.getFunctionTypes().findImplementingOperation(declaredType);
				if (operation == null) {
					return false;
				}
				if (closure.isExplicitSyntax() && closure.getDeclaredFormalParameters().size() != operation.getParameters().size()) {
					return false;
				}
			}
		}
	}
	return true;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:33,代码来源:AbstractPendingLinkingCandidate.java


示例5: eSet

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue)
{
  switch (featureID)
  {
    case FormatPackage.MATCHER__LOCATOR:
      setLocator((Locator)newValue);
      return;
    case FormatPackage.MATCHER__TYPE:
      setType((MatcherType)newValue);
      return;
    case FormatPackage.MATCHER__CONDITION:
      setCondition((XExpression)newValue);
      return;
  }
  super.eSet(featureID, newValue);
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:23,代码来源:MatcherImpl.java


示例6: evaluateAssociatedExpression

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
public EvaluationResult evaluateAssociatedExpression(final XExpression it, final EvaluationContext context) {
  EvaluationResult _switchResult = null;
  boolean _matched = false;
  if (it instanceof XAbstractFeatureCall) {
    JvmIdentifiableElement _feature = ((XAbstractFeatureCall)it).getFeature();
    if ((_feature instanceof JvmEnumerationLiteral)) {
      _matched=true;
      final EvaluationResult arg = this.doEvaluate(it, context);
      Object _rawValue = arg.getRawValue();
      return new EvaluationResult(_rawValue, false);
    }
  }
  if (!_matched) {
    _switchResult = this.doEvaluate(it, context);
  }
  return _switchResult;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:ConstantConditionsInterpreter.java


示例7: convertMultiType

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
private void convertMultiType(LightweightTypeReference expectation, CompoundTypeReference multiType, XExpression context,
		ITreeAppendable b, Later expression) {
	LightweightTypeReference castTo = null;
	List<LightweightTypeReference> components = multiType.getMultiTypeComponents();
	ITypeReferenceOwner owner = multiType.getOwner();
	LightweightTypeReference commonType = owner.getServices().getTypeConformanceComputer().getCommonSuperType(components, owner);
	if (!isJavaConformant(expectation, commonType)) {
		for(LightweightTypeReference candidate: multiType.getMultiTypeComponents()) {
			if (isJavaConformant(expectation, candidate)) {
				castTo = candidate;
				break;
			}
		}
	}
	if (castTo != null && mustInsertTypeCast(context, castTo)) {
		b.append("((");
		b.append(castTo);
		b.append(")");
		expression.exec(b);
		b.append(")");
	} else {
		expression.exec(b);
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:25,代码来源:TypeConvertingCompiler.java


示例8: toResolvedOperations

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
public ResolvedFeatures toResolvedOperations(final Class<?> type) {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("typeof(");
    String _canonicalName = type.getCanonicalName();
    _builder.append(_canonicalName);
    _builder.append(")");
    XExpression _expression = this.expression(_builder);
    final XTypeLiteral typeLiteral = ((XTypeLiteral) _expression);
    JvmType _type = typeLiteral.getType();
    final ResolvedFeatures result = this.overrideHelper.getResolvedFeatures(((JvmDeclaredType) _type));
    return result;
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:ResolvedFeaturesTest.java


示例9: setOperand

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setOperand(XExpression newOperand)
{
	if (newOperand != operand)
	{
		NotificationChain msgs = null;
		if (operand != null)
			msgs = ((InternalEObject)operand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XPOSTFIX_OPERATION__OPERAND, null, msgs);
		if (newOperand != null)
			msgs = ((InternalEObject)newOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XPOSTFIX_OPERATION__OPERAND, null, msgs);
		msgs = basicSetOperand(newOperand, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XPOSTFIX_OPERATION__OPERAND, newOperand, newOperand));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:XPostfixOperationImpl.java


示例10: isImplicitReturn

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
protected boolean isImplicitReturn(ITypeComputationResult expressionResult) {
	int flags = expressionResult.getConformanceFlags();
	if ((ConformanceFlags.NO_IMPLICIT_RETURN & flags) != 0) {
		return false;
	}
	XExpression expression = expressionResult.getExpression();
	if (expression == null) {
		return true;
	}
	if (expression.eClass() == XbasePackage.Literals.XRETURN_EXPRESSION) {
		return false;
	}
	TreeIterator<EObject> contents = expression.eAllContents();
	while (contents.hasNext()) {
		EObject next = contents.next();
		if (next.eClass() == XbasePackage.Literals.XRETURN_EXPRESSION) {
			return false;
		}
		if (next.eClass() == XbasePackage.Literals.XCLOSURE) {
			contents.prune();
		}
	}
	return true;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:25,代码来源:ClosureWithExpectationHelper.java


示例11: setExpression

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setExpression(XExpression newExpression)
{
	if (newExpression != expression)
	{
		NotificationChain msgs = null;
		if (expression != null)
			msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__EXPRESSION, null, msgs);
		if (newExpression != null)
			msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__EXPRESSION, null, msgs);
		msgs = basicSetExpression(newExpression, msgs);
		if (msgs != null) msgs.dispatch();
	}
	else if (eNotificationRequired())
		eNotify(new ENotificationImpl(this, Notification.SET, XbasePackage.XBASIC_FOR_LOOP_EXPRESSION__EXPRESSION, newExpression, newExpression));
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:XBasicForLoopExpressionImpl.java


示例12: testExtends

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
@Test
public void testExtends() {
  try {
    final XExpression expression = this.expression("null", false);
    final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
      it.setAbstract(true);
      EList<JvmTypeReference> _superTypes = it.getSuperTypes();
      JvmTypeReference _typeRef = this.typeRef(expression, AbstractList.class, String.class);
      this.builder.<JvmTypeReference>operator_add(_superTypes, _typeRef);
    };
    final JvmGenericType clazz = this.builder.toClass(expression, "my.test.Foo", _function);
    final Class<?> compiled = this.compile(expression.eResource(), clazz);
    Assert.assertTrue(Iterable.class.isAssignableFrom(compiled));
    Assert.assertTrue(AbstractList.class.isAssignableFrom(compiled));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:JvmModelGeneratorTest.java


示例13: testSwitchDeclaredParameter_5

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
@Test
public void testSwitchDeclaredParameter_5() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("switch (Integer x : \"lalala\") {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    final XExpression block = this.expression(_builder);
    this._validationTestHelper.assertError(block, XbasePackage.Literals.XSTRING_LITERAL, IssueCodes.INCOMPATIBLE_TYPES);
    this._validationTestHelper.assertWarning(block, TypesPackage.Literals.JVM_FORMAL_PARAMETER, IssueCodes.UNUSED_LOCAL_VARIABLE);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:22,代码来源:XbaseValidationTest.java


示例14: isVariableDeclarationRequired

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
protected boolean isVariableDeclarationRequired(XAbstractFeatureCall featureCall, XExpression expression, ITreeAppendable b) {
	if (featureCall == null) 
		return false;
	
	XExpression actualReceiver = normalizeBlockExpression(getActualReceiver(featureCall));
	List<XExpression> arguments = getActualArguments(featureCall);
	
	XExpression argument = normalizeBlockExpression(expression);
	
	int argumentIndex = -1;
	if (actualReceiver != argument) {
		argumentIndex = arguments.indexOf(argument);
		if (argumentIndex == -1)
			return false;
	}
	
	if (!expressionHelper.hasSideEffects(argument))
		return false;
	
	int startIndex = argumentIndex + 1;
	int endIndex = arguments.size();
	for (int i = startIndex; i < endIndex; i++) {
		if (isVariableDeclarationRequired(arguments.get(i), b, false))
			return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:28,代码来源:FeatureCallCompiler.java


示例15: evaluatesTo

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
protected void evaluatesTo(final Pair<String, String> typeAndExpression, final Procedure1<? super Object> assertions) {
  try {
    final String type = typeAndExpression.getKey();
    final String expression = typeAndExpression.getValue();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val");
    {
      if ((type != null)) {
        _builder.append(" ");
        _builder.append(type, "\t");
      }
    }
    _builder.append(" testFoo = ");
    _builder.append(expression, "\t");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    final String charSequence = _builder.toString();
    XExpression _expression = this.expression(charSequence, true);
    final XBlockExpression blockExpression = ((XBlockExpression) _expression);
    XExpression _head = IterableExtensions.<XExpression>head(blockExpression.getExpressions());
    final XVariableDeclaration variableDeclaration = ((XVariableDeclaration) _head);
    this.evaluatesTo(variableDeclaration, assertions);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:31,代码来源:SwitchConstantExpressionsInterpreterTest.java


示例16: mergeExpressionTypesIntoParent

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
protected void mergeExpressionTypesIntoParent(ResolvedTypes parent) {
	Map<XExpression, List<TypeData>> expressionTypes = basicGetExpressionTypes();
	if (!expressionTypes.isEmpty()) {
		for(Map.Entry<XExpression, List<TypeData>> entry: expressionTypes.entrySet()) {
			List<TypeData> list = entry.getValue();
			for (int i = 0, size = list.size(); i < size; i++) {
				parent.acceptType(entry.getKey(), prepareMerge(list.get(i), parent.getReferenceOwner()));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:StackedResolvedTypes.java


示例17: testSealedType

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
@Test
public void testSealedType() {
  try {
    final XExpression e = this.expression("null");
    JvmType _findDeclaredType = this._typeReferences.findDeclaredType(String.class, e);
    Assert.assertEquals("java.lang.String", this._jvmDeclaredTypeSignatureHashProvider.getHash(((JvmDeclaredType) _findDeclaredType)));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:11,代码来源:TypeSignatureHashTest.java


示例18: findClosures

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
protected List<XClosure> findClosures(final CharSequence expression) {
  try {
    final String expressionAsString = expression.toString().replace("ClosureTypeResolutionTestData", "org.eclipse.xtext.xbase.tests.typesystem.ClosureTypeResolutionTestData").replace("$$", "org::eclipse::xtext::xbase::lib::");
    final XExpression xExpression = this.expression(expressionAsString, false);
    final List<XClosure> Closures = IteratorExtensions.<XClosure>toList(Iterators.<XClosure>filter(EcoreUtil2.eAll(xExpression), XClosure.class));
    final Function1<XClosure, Integer> _function = (XClosure it) -> {
      return Integer.valueOf(NodeModelUtils.findActualNodeFor(it).getOffset());
    };
    return IterableExtensions.<XClosure, Integer>sortBy(Closures, _function);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:14,代码来源:AbstractClosureTypeTest2.java


示例19: notConstantExpression

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
public ConstantExpressionEvaluationException notConstantExpression(final XExpression expression) {
  String _text = null;
  if (expression!=null) {
    _text=this.toText(expression);
  }
  String _plus = ("Not a constant expression : \'" + _text);
  String _plus_1 = (_plus + "\'");
  return new ConstantExpressionEvaluationException(_plus_1, expression);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:10,代码来源:AbstractConstantExpressionsInterpreter.java


示例20: getDefaultValueLiteral

import org.eclipse.xtext.xbase.XExpression; //导入依赖的package包/类
protected String getDefaultValueLiteral(XExpression expr) {
	LightweightTypeReference type = getTypeForVariableDeclaration(expr);
	if (type.isPrimitive()) {
		if (type.getPrimitiveKind() == Primitives.Primitive.Boolean) {
			return "false";
		} else {
			return "(" + type.getSimpleName() + ") 0";
		}
	}
	return "null";
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:12,代码来源:AbstractXbaseCompiler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProblemReporter类代码示例发布时间:2022-05-22
下一篇:
Java SQLiteDataSource类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap