@Override public boolean isInterfaceType() { if (internalIsResolved()) { return resolvedTo.isInterfaceType(); } return false; }
protected List<LightweightTypeReference> getNonInterfaceTypes(List<LightweightTypeReference> components) { List<LightweightTypeReference> nonInterfaceTypes = null; for(LightweightTypeReference component: components) { if (!component.isInterfaceType()) { if (nonInterfaceTypes == null) { nonInterfaceTypes = Collections.singletonList(component); } else if (nonInterfaceTypes.size() == 1) { nonInterfaceTypes = Lists.newArrayList(nonInterfaceTypes); nonInterfaceTypes.add(component); } else { nonInterfaceTypes.add(component); } } } return nonInterfaceTypes; }
@Override public boolean isInterfaceType() { for(LightweightTypeReference component: expose(components)) { if (component.isInterfaceType()) return true; } return false; }
/** Replies if the given JVM element is a SARL capacity. * * @param type the JVM type to test. * @return {@code true} if the given type is a SARL capacity, or not. * @since 0.8 */ public boolean isSarlCapacity(LightweightTypeReference type) { return type.isInterfaceType() && (getSarlElementEcoreType(type) == SarlPackage.SARL_CAPACITY || type.isSubtypeOf(Capacity.class)); }
/** Replies if the given JVM element is a SARL behavior. * * @param type the JVM type to test. * @return {@code true} if the given type is a SARL behavior, or not. * @since 0.8 */ public boolean isSarlBehavior(LightweightTypeReference type) { return !type.isInterfaceType() && (getSarlElementEcoreType(type) == SarlPackage.SARL_BEHAVIOR || type.isSubtypeOf(Behavior.class)); }
/** Replies if the given JVM element is a SARL skill. * * @param type the JVM type to test. * @return {@code true} if the given type is a SARL skill, or not. * @since 0.8 */ public boolean isSarlSkill(LightweightTypeReference type) { return !type.isInterfaceType() && (getSarlElementEcoreType(type) == SarlPackage.SARL_SKILL || type.isSubtypeOf(Skill.class)); }
/** Replies if the given JVM element is a SARL agent. * * @param type the JVM type to test. * @return {@code true} if the given type is a SARL agent, or not. * @since 0.8 */ public boolean isSarlAgent(LightweightTypeReference type) { return !type.isInterfaceType() && (getSarlElementEcoreType(type) == SarlPackage.SARL_AGENT || type.isSubtypeOf(Agent.class)); }
/** Replies if the given JVM element is a SARL event. * * @param type the JVM type to test. * @return {@code true} if the given type is a SARL event, or not. * @since 0.8 */ public boolean isSarlEvent(LightweightTypeReference type) { return !type.isInterfaceType() && (getSarlElementEcoreType(type) == SarlPackage.SARL_EVENT || type.isSubtypeOf(Event.class)); }
/** Replies if the type candidate is a subtype of the given super type. * * @param candidate the type to test. * @param jvmSuperType the expected JVM super-type. * @param sarlSuperType the expected SARL super-type. * @param onlyInterface <code>true</code> if only interface types are matching; <code>false</code> if * not-interface types are matching. * @return <code>true</code> if the candidate is a sub-type of the super-type. */ public boolean isSubTypeOf(JvmType candidate, Class<?> jvmSuperType, Class<? extends XtendTypeDeclaration> sarlSuperType, boolean onlyInterface) { // Test the subtyping between the JVM elements. final LightweightTypeReference reference = Utils.toLightweightTypeReference(candidate, this.services); if (reference.isInterfaceType() != onlyInterface) { return false; } return isSubTypeOf(reference, jvmSuperType, sarlSuperType); }
/** Replies if the type candidate is a subtype of the given super type. * * @param candidate the type to test. * @param jvmSuperType the expected JVM super-type. * @param sarlSuperType the expected SARL super-type. * @param onlyInterface <code>true</code> if only interface types are matching; <code>false</code> if * not-interface types are matching. * @return <code>true</code> if the candidate is a sub-type of the super-type. */ public boolean isSubTypeOf(JvmTypeReference candidate, Class<?> jvmSuperType, Class<? extends XtendTypeDeclaration> sarlSuperType, boolean onlyInterface) { // Test the subtyping between the JVM elements. final LightweightTypeReference reference = Utils.toLightweightTypeReference(candidate, this.services); if (reference.isInterfaceType() != onlyInterface) { return false; } return isSubTypeOf(reference, jvmSuperType, sarlSuperType); }
protected boolean canCompileToJavaLambda(XClosure closure, LightweightTypeReference typeRef, JvmOperation operation) { if (!typeRef.isInterfaceType()) return false; if (!operation.getTypeParameters().isEmpty()) return false; TreeIterator<EObject> iterator = closure.eAllContents(); JvmType jvmType = typeRef.getType(); while (iterator.hasNext()) { EObject obj = iterator.next(); if (obj instanceof XClosure) { iterator.prune(); } else if (obj instanceof XFeatureCall && isReferenceToSelf((XFeatureCall) obj, jvmType)) { return false; } } return true; }
List<LightweightTypeReference> superTypes = typeReference.getSuperTypes(); for (final LightweightTypeReference superType : superTypes) { boolean _isInterfaceType = superType.isInterfaceType(); boolean _not = (!_isInterfaceType); if (_not) {
final LightweightTypeReference ref = toLightweightTypeReference(superType); if (ref != null && (!ref.isInterfaceType() || !ref.isSubtypeOf(expectedType) || (onlySubTypes && ref.isType(expectedType)))) { final String msg;
@Override public LightweightTypeReference toJavaType() { if (isMultiType()) { LightweightTypeReference result = null; for(LightweightTypeReference component: getMultiTypeComponents()) { if (!component.isInterfaceType()) { if (result != null) { result = null; break; } result = component; } } if (result != null) { return result; } } LightweightTypeReference result = getServices().getTypeConformanceComputer().getCommonSuperType(getMultiTypeComponents(), getOwner()); if (result == null) { throw new IllegalStateException("Cannot expression " + this + " as Java type reference"); } return result.toJavaType(); }
appendable.newLine().append("class "); //$NON-NLS-1$ appendable.append(implementationType); if (type.isInterfaceType()) { appendable.append(" implements "); //$NON-NLS-1$ } else {