/** Replies the guard evaluation code for the given event. * * @param source the source of the guard evaluation. * @return the guard evaluators. */ public Collection<Procedure1<? super ITreeAppendable>> getGuardEvalationCodeFor(SarlBehaviorUnit source) { assert source != null; final String id = source.getName().getIdentifier(); final Collection<Procedure1<? super ITreeAppendable>> evaluators; final Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>> pair = this.guardEvaluators.get(id); if (pair == null) { evaluators = new ArrayList<>(); this.guardEvaluators.put(id, new Pair<>(source, evaluators)); } else { evaluators = pair.getValue(); assert evaluators != null; } return evaluators; }
@Override public int compare(SarlBehaviorUnit o1, SarlBehaviorUnit o2) { if (o1 == o2) { return 0; } if (o1 == null) { return Integer.MIN_VALUE; } if (o2 == null) { return Integer.MAX_VALUE; } final int cmp = o1.getName().getIdentifier().compareTo(o2.getName().getIdentifier()); if (cmp != 0) { return cmp; } return compare(o1.getGuard(), o2.getGuard()); }
/** Generate the implemented types for the given SARL statement. * * @param context the context of the generation. * @param owner the JVM element to change. * @param defaultJvmType the default JVM type. * @param defaultSarlType the default SARL type. * @param implementedtypes the implemented types. */ protected void appendConstrainedImplements( GenerationContext context, JvmGenericType owner, Class<?> defaultJvmType, Class<? extends XtendTypeDeclaration> defaultSarlType, List<? extends JvmParameterizedTypeReference> implementedtypes) { boolean explicitType = false; for (final JvmParameterizedTypeReference superType : implementedtypes) { if (!Objects.equal(owner.getIdentifier(), superType.getIdentifier()) && superType.getType() instanceof JvmGenericType /*&& this.inheritanceHelper.isProxyOrSubTypeOf(superType, defaultJvmType, defaultSarlType, true)*/) { owner.getSuperTypes().add(this.typeBuilder.cloneWithProxies(superType)); context.incrementSerial(superType.getIdentifier().hashCode()); explicitType = true; } } if (!explicitType) { final JvmTypeReference type = this._typeReferenceBuilder.typeRef(defaultJvmType); owner.getSuperTypes().add(type); context.incrementSerial(type.getIdentifier().hashCode()); } }
String superTypeId; try { superTypeId = superType.getIdentifier(); } catch (Exception ex) { logInternalError(ex); context.incrementSerial(superType.getIdentifier().hashCode()); explicitType = true;