/** Create a SarlRequiredCapacity. * @param name the types referenced by the SarlRequiredCapacity. */ public void addSarlRequiredCapacity(String... name) { if (name != null && name.length > 0) { SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } }
/** Create a SarlCapacityUses. * @param name the types referenced by the SarlCapacityUses. */ public void addSarlCapacityUses(String... name) { if (name != null && name.length > 0) { SarlCapacityUses member = SarlFactory.eINSTANCE.createSarlCapacityUses(); this.sarlBehavior.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlBehavior, aname)); } } } }
/** Generate the given object. * * @param behavior the behavior. * @param context the context. */ protected void _generate(SarlBehavior behavior, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(behavior); final PyAppendable appendable = createAppendable(jvmType, context); final List<JvmTypeReference> superTypes; if (behavior.getExtends() != null) { superTypes = Collections.singletonList(behavior.getExtends()); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Behavior.class, behavior)); } final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(behavior).toString(); if (generateTypeDeclaration( qualifiedName, behavior.getName(), behavior.isAbstract(), superTypes, getTypeBuilder().getDocumentation(behavior), true, behavior.getMembers(), appendable, context, (it, context2) -> { generateGuardEvaluators(qualifiedName, it, context2); })) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(behavior); writeFile(name, appendable, context); } }