Ejemplo n.º 1
0
 protected CharSequence _toHtml(final CodeRef it) {
   CharSequence _xblockexpression = null;
   {
     JvmDeclaredType _element = it.getElement();
     String _identifier = _element.getIdentifier();
     String _operator_plus = StringExtensions.operator_plus("TODO CodeRef to: ", _identifier);
     InputOutput.<String>println(_operator_plus);
     CharSequence _xifexpression = null;
     TextOrMarkup _altText = it.getAltText();
     boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_altText, null);
     if (_operator_notEquals) {
       TextOrMarkup _altText_1 = it.getAltText();
       CharSequence _html = this.toHtml(_altText_1);
       _xifexpression = _html;
     } else {
       JvmDeclaredType _element_1 = it.getElement();
       String _identifier_1 = _element_1.getIdentifier();
       String _operator_plus_1 =
           StringExtensions.operator_plus("<code class=\"prettyprint lang-java\">", _identifier_1);
       String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, "</code>");
       _xifexpression = _operator_plus_2;
     }
     _xblockexpression = (_xifexpression);
   }
   return _xblockexpression;
 }
 public StyledString createStyledStringForVersion(
     final ExtensionGeneratorDelegate.Metadata metadata) {
   String _version = metadata.getVersion();
   final StyledString result = new StyledString(_version);
   StringConcatenation _builder = new StringConcatenation();
   _builder.append(" ");
   String _name = metadata.getName();
   _builder.append(_name, " ");
   result.append(_builder.toString(), StyledString.QUALIFIER_STYLER);
   String _license = metadata.getLicense();
   boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_license);
   boolean _not = (!_isNullOrEmpty);
   if (_not) {
     StringConcatenation _builder_1 = new StringConcatenation();
     _builder_1.append(" ");
     _builder_1.append("under ");
     String _license_1 = metadata.getLicense();
     _builder_1.append(_license_1, " ");
     result.append(_builder_1.toString(), StyledString.QUALIFIER_STYLER);
   }
   String _description = metadata.getDescription();
   boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(_description);
   boolean _not_1 = (!_isNullOrEmpty_1);
   if (_not_1) {
     StringConcatenation _builder_2 = new StringConcatenation();
     _builder_2.append(" ");
     _builder_2.append("- ");
     String _description_1 = metadata.getDescription();
     _builder_2.append(_description_1, " ");
     result.append(_builder_2.toString(), StyledString.COUNTER_STYLER);
   }
   return result;
 }
 public String simpleName(final ModuleAST module) {
   String _name = module.getName();
   String[] _split = _name.split("\\.");
   String _last =
       IterableExtensions.<String>last(((Iterable<String>) Conversions.doWrapArray(_split)));
   return StringExtensions.toFirstLower(_last);
 }
Ejemplo n.º 4
0
 @Check
 public void checkConstantUppercase(final MobaConstantValue value) {
   String _valueString = value.getValueString();
   boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_valueString);
   boolean _not = (!_isNullOrEmpty);
   if (_not) {
     MobaConstant _valueConst = value.getValueConst();
     boolean _notEquals = (!Objects.equal(_valueConst, null));
     if (_notEquals) {
       MobaConstant _valueConst_1 = value.getValueConst();
       String _value = _valueConst_1.getValue();
       String _upperCase = _value.toUpperCase();
       MobaConstant _valueConst_2 = value.getValueConst();
       String _value_1 = _valueConst_2.getValue();
       boolean _equals = _upperCase.equals(_value_1);
       boolean _not_1 = (!_equals);
       if (_not_1) {
         StringConcatenation _builder = new StringConcatenation();
         _builder.append("Constant values need to be upper case!");
         this.error(
             _builder.toString(), value, MobaPackage.Literals.MOBA_CONSTANT_VALUE__VALUE_CONST);
       }
     }
   }
 }
 protected Object _execute(final HistoryEntry entry) throws ExecutionException {
   Object _xblockexpression = null;
   {
     ExecutionRegion _region = entry.getRegion();
     ExecutionState _historyStateConfiguration =
         this.executionContext.getHistoryStateConfiguration(_region);
     boolean _operator_notEquals =
         ObjectExtensions.operator_notEquals(_historyStateConfiguration, null);
     if (_operator_notEquals) {
       Step _historyStep = entry.getHistoryStep();
       this.execute(_historyStep);
     } else {
       Step _initialStep = entry.getInitialStep();
       boolean _operator_equals = ObjectExtensions.operator_equals(_initialStep, null);
       if (_operator_equals) {
         String _operator_plus =
             StringExtensions.operator_plus("Missing initial transition ", entry);
         InputOutput.<String>println(_operator_plus);
       } else {
         Step _initialStep_1 = entry.getInitialStep();
         this.execute(_initialStep_1);
       }
     }
     _xblockexpression = (null);
   }
   return _xblockexpression;
 }
 public String concatPackage(final String prefix, final String suffix) {
   String _xifexpression = null;
   boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(prefix);
   if (_isNullOrEmpty) {
     _xifexpression = suffix;
   } else {
     _xifexpression = ((prefix + ".") + suffix);
   }
   return _xifexpression;
 }
Ejemplo n.º 7
0
 protected CharSequence _toHtml(final Todo it) {
   String _xblockexpression = null;
   {
     String _text = it.getText();
     String _operator_plus = StringExtensions.operator_plus("TODO: ", _text);
     InputOutput.<String>println(_operator_plus);
     _xblockexpression = ("");
   }
   return _xblockexpression;
 }
Ejemplo n.º 8
0
 protected CharSequence _toHtml(final EObject it) {
   String _xblockexpression = null;
   {
     EClass _eClass = it.eClass();
     String _name = _eClass.getName();
     String _operator_plus = StringExtensions.operator_plus("Missing toHtml for ", _name);
     InputOutput.<String>println(_operator_plus);
     _xblockexpression = ("");
   }
   return _xblockexpression;
 }
Ejemplo n.º 9
0
 public String href(final Identifiable it) {
   String _xifexpression = null;
   String _name = it.getName();
   boolean _operator_notEquals = ObjectExtensions.operator_notEquals(_name, null);
   if (_operator_notEquals) {
     String _name_1 = it.getName();
     _xifexpression = _name_1;
   } else {
     String _xifexpression_1 = null;
     Map<Identifiable, String> _artificialHrefs = this.artificialHrefs;
     boolean _containsKey = _artificialHrefs.containsKey(it);
     if (_containsKey) {
       Map<Identifiable, String> _artificialHrefs_1 = this.artificialHrefs;
       String _get = _artificialHrefs_1.get(it);
       _xifexpression_1 = _get;
     } else {
       String _xblockexpression = null;
       {
         EClass _eClass = it.eClass();
         String _name_2 = _eClass.getName();
         String _operator_plus = StringExtensions.operator_plus(_name_2, "_");
         Map<Identifiable, String> _artificialHrefs_2 = this.artificialHrefs;
         int _size = _artificialHrefs_2.size();
         String _operator_plus_1 =
             StringExtensions.operator_plus(_operator_plus, Integer.valueOf(_size));
         final String newHref = _operator_plus_1;
         Map<Identifiable, String> _artificialHrefs_3 = this.artificialHrefs;
         _artificialHrefs_3.put(it, newHref);
         _xblockexpression = (newHref);
       }
       _xifexpression_1 = _xblockexpression;
     }
     _xifexpression = _xifexpression_1;
   }
   return _xifexpression;
 }
  @Override
  protected void setDefaultValue(
      FeatureType featureType, FeatureParameterValue parameterValue, EObject contextElement) {
    GeneratorEntry entry = (GeneratorEntry) contextElement;
    Statechart statechart = (Statechart) entry.getElementRef();

    if (parameterValue
        .getParameter()
        .getName()
        .equals(ICFeatureConstants.PARAMETER_NAMING_MODULE_NAME)) {
      parameterValue.setValue(asIdentifier(statechart.getName(), "_"));
    } else if (parameterValue
        .getParameter()
        .getName()
        .equals(ICFeatureConstants.PARAMETER_NAMING_STATEMACHINE_PREFIX)) {
      parameterValue.setValue(
          StringExtensions.toFirstLower(asIdentifier(statechart.getName(), "_")));
    } else if (parameterValue
        .getParameter()
        .getName()
        .equals(ICFeatureConstants.PARAMETER_NAMING_MAX_IDENTIFIER_LENGTH)) {
      parameterValue.setValue("31");
    } else if (parameterValue
        .getParameter()
        .getName()
        .equals(ICFeatureConstants.PARAMETER_NAMING_SEPARATOR)) {
      parameterValue.setValue("_");
    } else if (parameterValue
        .getParameter()
        .getName()
        .equals(CPPFeatureConstants.PARAMETER_INNER_FUNCTION_VISIBILITY)) {
      parameterValue.setValue(Visibility.PRIVATE.toString().toLowerCase());
    } else if (parameterValue
        .getParameter()
        .getName()
        .equals(CPPFeatureConstants.PARAMETER_STATIC_OPC)) {
      parameterValue.setValue(false);
    }
  }
Ejemplo n.º 11
0
 protected Result<Boolean> applyRuleEClassEObject(
     final RuleEnvironment G,
     final RuleApplicationTrace _trace_,
     final EClass eClass,
     final EObject object)
     throws RuleFailedException {
   String _string = new String();
   String _firstUpper = StringExtensions.toFirstUpper("bar");
   String _plus = (_string + _firstUpper);
   boolean _equals = Objects.equal("foo", _plus);
   /* 'foo' == new String() + 'bar'.toFirstUpper */
   if (!_equals) {
     sneakyThrowRuleFailedException("\'foo\' == new String() + \'bar\'.toFirstUpper");
   }
   final EClass eC = EcoreFactory.eINSTANCE.createEClass();
   eC.setName("MyEClass");
   /* eClass == eC */
   if (!Objects.equal(eClass, eC)) {
     sneakyThrowRuleFailedException("eClass == eC");
   }
   return new Result<Boolean>(true);
 }
Ejemplo n.º 12
0
 @Check
 public void checkDownloadTemplate(final MobaTemplate template) {
   boolean _and = false;
   String _downloadTemplate = template.getDownloadTemplate();
   boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_downloadTemplate);
   boolean _not = (!_isNullOrEmpty);
   if (!_not) {
     _and = false;
   } else {
     String _downloadTemplate_1 = template.getDownloadTemplate();
     boolean _startsWith = _downloadTemplate_1.startsWith("index://");
     _and = _startsWith;
   }
   if (_and) {
     this.error(
         "You need to download the template using the quickfix.",
         template,
         MobaPackage.Literals.MOBA_TEMPLATE__DOWNLOAD_TEMPLATE,
         MobaValidator.DOWNLOAD_TEMPLATE,
         null);
   }
 }
Ejemplo n.º 13
0
 @Check
 public Object checkRestAttributeAssignment(final MobaRESTAttribute att) {
   Object _xblockexpression = null;
   {
     final MobaDataType dt = att.getType();
     final String value = att.getValue();
     EStructuralFeature _xifexpression = null;
     MobaConstant _valueConst = att.getValueConst();
     boolean _notEquals = (!Objects.equal(_valueConst, null));
     if (_notEquals) {
       _xifexpression = MobaPackage.Literals.MOBA_REST_ATTRIBUTE__VALUE_CONST;
     } else {
       _xifexpression = MobaPackage.Literals.MOBA_REST_ATTRIBUTE__VALUE_STRING;
     }
     final EStructuralFeature eAtt = _xifexpression;
     Object _xifexpression_1 = null;
     boolean _isArray = dt.isArray();
     if (_isArray) {
       String _value = att.getValue();
       boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(_value);
       boolean _not = (!_isNullOrEmpty);
       if (_not) {
         StringConcatenation _builder = new StringConcatenation();
         _builder.append("Array datatypes must not be assigned a value to.");
         this.error(_builder.toString(), att, eAtt);
       }
     } else {
       Object _xifexpression_2 = null;
       boolean _or = false;
       boolean _or_1 = false;
       boolean _isDate = dt.isDate();
       if (_isDate) {
         _or_1 = true;
       } else {
         boolean _isTime = dt.isTime();
         _or_1 = _isTime;
       }
       if (_or_1) {
         _or = true;
       } else {
         boolean _isTimestamp = dt.isTimestamp();
         _or = _isTimestamp;
       }
       if (_or) {
         Date _xblockexpression_1 = null;
         {
           SimpleDateFormat _xifexpression_3 = null;
           String _dateFormat = dt.getDateFormat();
           boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(_dateFormat);
           boolean _not_1 = (!_isNullOrEmpty_1);
           if (_not_1) {
             String _dateFormat_1 = dt.getDateFormat();
             _xifexpression_3 = new SimpleDateFormat(_dateFormat_1);
           } else {
             _xifexpression_3 = new SimpleDateFormat();
           }
           final SimpleDateFormat df = _xifexpression_3;
           Date _xtrycatchfinallyexpression = null;
           try {
             _xtrycatchfinallyexpression = df.parse(value);
           } catch (final Throwable _t) {
             if (_t instanceof ParseException) {
               final ParseException ex = (ParseException) _t;
               StringConcatenation _builder_1 = new StringConcatenation();
               _builder_1.append("Value ");
               _builder_1.append(value, "");
               _builder_1.append(" is not a valid date using dateformat ");
               String _pattern = df.toPattern();
               _builder_1.append(_pattern, "");
               _builder_1.append("!");
               this.error(_builder_1.toString(), att, eAtt);
             } else {
               throw Exceptions.sneakyThrow(_t);
             }
           }
           _xblockexpression_1 = _xtrycatchfinallyexpression;
         }
         _xifexpression_2 = _xblockexpression_1;
       } else {
         Number _xifexpression_3 = null;
         boolean _isEnum = dt.isEnum();
         if (_isEnum) {
           String _value_1 = att.getValue();
           boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(_value_1);
           boolean _not_1 = (!_isNullOrEmpty_1);
           if (_not_1) {
             StringConcatenation _builder_1 = new StringConcatenation();
             _builder_1.append("Enum datatypes must not be assigned a value to.");
             this.error(_builder_1.toString(), att, eAtt);
           }
         } else {
           Number _xifexpression_4 = null;
           boolean _isEnum_1 = dt.isEnum();
           if (_isEnum_1) {
             String _value_2 = att.getValue();
             boolean _isNullOrEmpty_2 = StringExtensions.isNullOrEmpty(_value_2);
             boolean _not_2 = (!_isNullOrEmpty_2);
             if (_not_2) {
               StringConcatenation _builder_2 = new StringConcatenation();
               _builder_2.append("Enum datatypes must not be assigned a value to.");
               this.error(_builder_2.toString(), att, eAtt);
             }
           } else {
             Number _xifexpression_5 = null;
             boolean _isNumeric = dt.isNumeric();
             if (_isNumeric) {
               Integer _xifexpression_6 = null;
               ValueType _valueType = att.getValueType();
               boolean _notEquals_1 = (!Objects.equal(_valueType, ValueType.NUMERIC));
               if (_notEquals_1) {
                 Integer _xifexpression_7 = null;
                 boolean _or_2 = false;
                 ValueType _valueType_1 = att.getValueType();
                 boolean _equals = Objects.equal(_valueType_1, ValueType.CONSTANT);
                 if (_equals) {
                   _or_2 = true;
                 } else {
                   ValueType _valueType_2 = att.getValueType();
                   boolean _equals_1 = Objects.equal(_valueType_2, ValueType.STRING);
                   _or_2 = _equals_1;
                 }
                 if (_or_2) {
                   Integer _xtrycatchfinallyexpression = null;
                   try {
                     String _value_3 = att.getValue();
                     _xtrycatchfinallyexpression = Integer.valueOf(_value_3);
                   } catch (final Throwable _t) {
                     if (_t instanceof NumberFormatException) {
                       final NumberFormatException ex = (NumberFormatException) _t;
                       StringConcatenation _builder_3 = new StringConcatenation();
                       _builder_3.append("Value ");
                       _builder_3.append(value, "");
                       _builder_3.append(" is not a valid numeric!");
                       this.error(_builder_3.toString(), att, eAtt);
                     } else {
                       throw Exceptions.sneakyThrow(_t);
                     }
                   }
                   _xifexpression_7 = _xtrycatchfinallyexpression;
                 } else {
                   StringConcatenation _builder_4 = new StringConcatenation();
                   _builder_4.append("Can not assign ");
                   ValueType _valueType_3 = att.getValueType();
                   _builder_4.append(_valueType_3, "");
                   _builder_4.append(" to numeric datatype!");
                   this.error(_builder_4.toString(), att, eAtt);
                 }
                 _xifexpression_6 = _xifexpression_7;
               }
               _xifexpression_5 = _xifexpression_6;
             } else {
               Double _xifexpression_8 = null;
               boolean _isDecimal = dt.isDecimal();
               if (_isDecimal) {
                 Double _xifexpression_9 = null;
                 boolean _and = false;
                 ValueType _valueType_4 = att.getValueType();
                 boolean _notEquals_2 = (!Objects.equal(_valueType_4, ValueType.NUMERIC));
                 if (!_notEquals_2) {
                   _and = false;
                 } else {
                   ValueType _valueType_5 = att.getValueType();
                   boolean _notEquals_3 = (!Objects.equal(_valueType_5, ValueType.DECIMAL));
                   _and = _notEquals_3;
                 }
                 if (_and) {
                   Double _xifexpression_10 = null;
                   boolean _or_3 = false;
                   ValueType _valueType_6 = att.getValueType();
                   boolean _equals_2 = Objects.equal(_valueType_6, ValueType.CONSTANT);
                   if (_equals_2) {
                     _or_3 = true;
                   } else {
                     ValueType _valueType_7 = att.getValueType();
                     boolean _equals_3 = Objects.equal(_valueType_7, ValueType.STRING);
                     _or_3 = _equals_3;
                   }
                   if (_or_3) {
                     Double _xtrycatchfinallyexpression_1 = null;
                     try {
                       String _value_4 = att.getValue();
                       _xtrycatchfinallyexpression_1 = Double.valueOf(_value_4);
                     } catch (final Throwable _t_1) {
                       if (_t_1 instanceof NumberFormatException) {
                         final NumberFormatException ex_1 = (NumberFormatException) _t_1;
                         StringConcatenation _builder_5 = new StringConcatenation();
                         _builder_5.append("Value ");
                         _builder_5.append(value, "");
                         _builder_5.append(" is not a valid decimal!");
                         this.error(_builder_5.toString(), att, eAtt);
                       } else {
                         throw Exceptions.sneakyThrow(_t_1);
                       }
                     }
                     _xifexpression_10 = _xtrycatchfinallyexpression_1;
                   } else {
                     StringConcatenation _builder_6 = new StringConcatenation();
                     _builder_6.append("Can not assign ");
                     ValueType _valueType_8 = att.getValueType();
                     _builder_6.append(_valueType_8, "");
                     _builder_6.append(" to decimal datatype!");
                     this.error(_builder_6.toString(), att, eAtt);
                   }
                   _xifexpression_9 = _xifexpression_10;
                 }
                 _xifexpression_8 = _xifexpression_9;
               }
               _xifexpression_5 = _xifexpression_8;
             }
             _xifexpression_4 = ((Number) _xifexpression_5);
           }
           _xifexpression_3 = ((Number) _xifexpression_4);
         }
         _xifexpression_2 = _xifexpression_3;
       }
       _xifexpression_1 = ((Object) _xifexpression_2);
     }
     _xblockexpression = ((Object) _xifexpression_1);
   }
   return _xblockexpression;
 }
Ejemplo n.º 14
0
 public String genJavaDocLink(final JvmIdentifiableElement ie) {
   String _xblockexpression = null;
   {
     String _qualifiedName = ie.getQualifiedName();
     boolean _operator_equals = ObjectExtensions.operator_equals(_qualifiedName, null);
     if (_operator_equals) {
       return null;
     }
     String _qualifiedName_1 = ie.getQualifiedName();
     String _replaceAll = _qualifiedName_1.replaceAll("\\.", "/");
     String _replaceAll_1 = _replaceAll.replaceAll("\\$", ".");
     final String file = _replaceAll_1;
     String _switchResult = null;
     String _qualifiedName_2 = ie.getQualifiedName();
     final String name = _qualifiedName_2;
     boolean matched = false;
     if (!matched) {
       boolean _startsWith = name.startsWith("org.eclipse.emf.mwe");
       if (_startsWith) {
         matched = true;
         _switchResult = "";
       }
     }
     if (!matched) {
       boolean _startsWith_1 = name.startsWith("org.eclipse.xtext.");
       if (_startsWith_1) {
         matched = true;
         _switchResult = "http://download.eclipse.org/modeling/tmf/xtext/javadoc/2.2.0/";
       }
     }
     if (!matched) {
       boolean _startsWith_2 = name.startsWith("org.eclipse.emf.");
       if (_startsWith_2) {
         matched = true;
         _switchResult = "http://download.eclipse.org/modeling/emf/emf/javadoc/2.6.0/";
       }
     }
     if (!matched) {
       boolean _startsWith_3 = name.startsWith("com.google.inject.");
       if (_startsWith_3) {
         matched = true;
         _switchResult = "http://google-guice.googlecode.com/svn/trunk/javadoc/";
       }
     }
     if (!matched) {
       boolean _startsWith_4 = name.startsWith("org.eclipse.jdt.");
       if (_startsWith_4) {
         matched = true;
         _switchResult =
             "http://help.eclipse.org/helios/topic/org.eclipse.jdt.doc.isv/reference/api/";
       }
     }
     if (!matched) {
       boolean _startsWith_5 = name.startsWith("java.");
       if (_startsWith_5) {
         matched = true;
         _switchResult = "http://download.oracle.com/javase/1.5.0/docs/api/";
       }
     }
     if (!matched) {
       boolean _startsWith_6 = name.startsWith("org.eclipse.");
       if (_startsWith_6) {
         matched = true;
         _switchResult =
             "http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api/";
       }
     }
     if (!matched) {
       _switchResult = "";
     }
     final String prefix = _switchResult;
     String _xifexpression = null;
     boolean _operator_notEquals = ObjectExtensions.operator_notEquals(prefix, "");
     if (_operator_notEquals) {
       String _operator_plus = StringExtensions.operator_plus(prefix, file);
       String _operator_plus_1 = StringExtensions.operator_plus(_operator_plus, ".html");
       _xifexpression = _operator_plus_1;
     } else {
       _xifexpression = null;
     }
     _xblockexpression = (_xifexpression);
   }
   return _xblockexpression;
 }
Ejemplo n.º 15
0
 public static String generate(final MyxGenBrick b) {
   MyxGenBrick _xtrycatchfinallyexpression = null;
   try {
     String _parentBrickId = b.getParentBrickId();
     MyxGenBrick _activeMyxGenBrick =
         MyxGenWorkspaceExtensions.getActiveMyxGenBrick(_parentBrickId);
     _xtrycatchfinallyexpression = _activeMyxGenBrick;
   } catch (final Throwable _t) {
     if (_t instanceof Exception) {
       final Exception e = (Exception) _t;
       _xtrycatchfinallyexpression = null;
     } else {
       throw Exceptions.sneakyThrow(_t);
     }
   }
   final MyxGenBrick pb = _xtrycatchfinallyexpression;
   try {
     StringConcatenation _builder = new StringConcatenation();
     _builder.append("package ");
     String _stubClassName = b.getStubClassName();
     String _packageName = MyxCompUtils.toPackageName(_stubClassName);
     _builder.append(_packageName, "");
     _builder.append(";");
     _builder.newLineIfNotEmpty();
     _builder.newLine();
     {
       boolean _equals = Objects.equal(pb, null);
       if (_equals) {
         _builder.append("import org.archstudio.myx.fw.MyxRegistry;");
         _builder.newLine();
       }
     }
     {
       Collection<MyxGenInterface> _interfaces = b.getInterfaces();
       int _size = _interfaces.size();
       boolean _greaterThan = (_size > 0);
       if (_greaterThan) {
         _builder.append("import org.archstudio.myx.fw.MyxUtils;");
         _builder.newLine();
       }
     }
     _builder.append("import org.archstudio.myx.fw.IMyxName;");
     _builder.newLine();
     _builder.newLine();
     _builder.append("/*");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* DO NOT EDIT THIS CLASS, it is automatically generated.");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* ANY MODIFICATIONS WILL BE OVERWRITTEN.");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("*");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* To modify, update the \"");
     String _name = b.getName();
     _builder.append(_name, " ");
     _builder.append("\" MyxGen ");
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("* extension in the ");
     IContributor _contributor = b.getContributor();
     String _name_1 = _contributor.getName();
     _builder.append(_name_1, " ");
     _builder.append(" plugin.");
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("*/");
     _builder.newLine();
     _builder.newLine();
     _builder.append("/**");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("* Abstract Myx brick: ");
     String _name_2 = b.getName();
     _builder.append(_name_2, " ");
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("* ");
     {
       String _description = b.getDescription();
       boolean _notEquals = (!Objects.equal(_description, null));
       if (_notEquals) {
         _builder.append("<p>");
         String _description_1 = b.getDescription();
         _builder.append(_description_1, " ");
       }
     }
     _builder.newLineIfNotEmpty();
     _builder.append(" ");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append(" ");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("public abstract class ");
     String _stubClassName_1 = b.getStubClassName();
     String _className = MyxCompUtils.toClassName(_stubClassName_1);
     _builder.append(_className, "");
     _builder.newLineIfNotEmpty();
     {
       boolean _equals_1 = Objects.equal(pb, null);
       if (_equals_1) {
         _builder.append("extends org.archstudio.myx.fw.AbstractMyxSimpleBrick");
         _builder.newLine();
       } else {
         _builder.append("extends ");
         String _className_1 = pb.getClassName();
         _builder.append(_className_1, "");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("implements org.archstudio.myx.fw.IMyxDynamicBrick");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_1 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EServiceObjectDelegate _serviceObjectDelegate = i.getServiceObjectDelegate();
               boolean _equals =
                   Objects.equal(_serviceObjectDelegate, EServiceObjectDelegate.brick);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_1, _function);
       boolean _hasElements = false;
       for (final MyxGenInterface i : _filter) {
         if (!_hasElements) {
           _hasElements = true;
           _builder.append(", ", "");
         } else {
           _builder.appendImmediate(", ", "");
         }
         String _className_2 = i.getClassName();
         _builder.append(_className_2, "");
       }
     }
     _builder.newLineIfNotEmpty();
     _builder.append("{");
     _builder.newLine();
     _builder.append("\t");
     _builder.newLine();
     {
       boolean _notEquals_1 = (!Objects.equal(pb, null));
       if (_notEquals_1) {
         _builder.append("\t");
         IContributor _contributor_1 = pb.getContributor();
         String _name_3 = _contributor_1.getName();
         String _className_3 = pb.getClassName();
         String _constructorsFor = MyxCompUtils.constructorsFor(b, _name_3, _className_3);
         _builder.append(_constructorsFor, "	");
         _builder.newLineIfNotEmpty();
       } else {
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* The registry of objects for this brick.");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(
             "protected final MyxRegistry myxRegistry = MyxRegistry.getSharedInstance();");
         _builder.newLine();
         _builder.append("\t");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* Register this brick instance with the registry.");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("@Override");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("public void begin(){");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("super.begin();");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("myxRegistry.register(this);");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
         _builder.append("\t");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* Unregister this brick instance with the registry.");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("@Override");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("public void end(){");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("myxRegistry.unregister(this);");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("\t");
         _builder.append("super.end();");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_2 = b.getInterfaces();
       for (final MyxGenInterface i_1 : _interfaces_2) {
         _builder.append("\t");
         _builder.append("/**");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* Myx name for the <code>");
         String _name_4 = i_1.getName();
         _builder.append(_name_4, "	 ");
         _builder.append("</code> interface.");
         _builder.newLineIfNotEmpty();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* ");
         {
           String _description_2 = i_1.getDescription();
           boolean _notEquals_2 = (!Objects.equal(_description_2, null));
           if (_notEquals_2) {
             _builder.append("<p>");
             String _description_3 = i_1.getDescription();
             _builder.append(_description_3, "	 ");
           }
         }
         _builder.newLineIfNotEmpty();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("* @generated");
         _builder.newLine();
         _builder.append("\t");
         _builder.append(" ");
         _builder.append("*/");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("public static final IMyxName ");
         EMyxInterfaceDirection _direction = i_1.getDirection();
         String _name_5 = _direction.name();
         String _lowerCase = _name_5.toLowerCase();
         String _name_6 = i_1.getName();
         String _firstUpper = StringExtensions.toFirstUpper(_name_6);
         String _plus = (_lowerCase + _firstUpper);
         String _constantName = MyxCompUtils.toConstantName(_plus);
         _builder.append(_constantName, "	");
         _builder.append(" = MyxUtils.createName(\"");
         String _id = i_1.getId();
         _builder.append(_id, "	");
         _builder.append("\");");
         _builder.newLineIfNotEmpty();
         _builder.append("\t");
         _builder.newLine();
         {
           EServiceObjectDelegate _serviceObjectDelegate = i_1.getServiceObjectDelegate();
           boolean _isNeedsVariable = _serviceObjectDelegate.isNeedsVariable();
           if (_isNeedsVariable) {
             _builder.append("\t");
             _builder.append("/**");
             _builder.newLine();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* Service object");
             {
               boolean _isSingle = i_1.isSingle();
               boolean _not = (!_isSingle);
               if (_not) {
                 _builder.append("s");
               }
             }
             _builder.append(" for the ");
             String _name_7 = i_1.getName();
             _builder.append(_name_7, "	 ");
             _builder.append(" interface.");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* @see #");
             EMyxInterfaceDirection _direction_1 = i_1.getDirection();
             String _name_8 = _direction_1.name();
             String _lowerCase_1 = _name_8.toLowerCase();
             String _name_9 = i_1.getName();
             String _firstUpper_1 = StringExtensions.toFirstUpper(_name_9);
             String _plus_1 = (_lowerCase_1 + _firstUpper_1);
             String _constantName_1 = MyxCompUtils.toConstantName(_plus_1);
             _builder.append(_constantName_1, "	 ");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* @generated");
             _builder.newLine();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("*/");
             _builder.newLine();
             {
               boolean _isSingle_1 = i_1.isSingle();
               if (_isSingle_1) {
                 _builder.append("\t");
                 _builder.append("protected ");
                 String _className_4 = i_1.getClassName();
                 _builder.append(_className_4, "	");
                 _builder.append(" ");
                 String _name_10 = i_1.getName();
                 _builder.append(_name_10, "	");
                 _builder.append(" = null;");
                 _builder.newLineIfNotEmpty();
               } else {
                 _builder.append("\t");
                 _builder.append("protected final java.util.Collection<");
                 String _className_5 = i_1.getClassName();
                 _builder.append(_className_5, "	");
                 _builder.append("> ");
                 String _name_11 = i_1.getName();
                 _builder.append(_name_11, "	");
                 _builder.append(" = new java.util.concurrent.CopyOnWriteArrayList<");
                 String _className_6 = i_1.getClassName();
                 _builder.append(_className_6, "	");
                 _builder.append(">();");
                 _builder.newLineIfNotEmpty();
               }
             }
           }
         }
         _builder.append("\t");
         _builder.newLine();
         {
           EServiceObjectDelegate _serviceObjectDelegate_1 = i_1.getServiceObjectDelegate();
           boolean _isNeedsProxy = _serviceObjectDelegate_1.isNeedsProxy();
           if (_isNeedsProxy) {
             _builder.append("\t");
             _builder.append("/**");
             _builder.newLine();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* Service object proxy for the ");
             String _name_12 = i_1.getName();
             _builder.append(_name_12, "	 ");
             _builder.append(" interface.");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append(" ");
             _builder.append("* Calls to this proxy object are automatically delegated to ");
             {
               EServiceObjectDelegate _serviceObjectDelegate_2 = i_1.getServiceObjectDelegate();
               boolean _equals_2 =
                   Objects.equal(_serviceObjectDelegate_2, EServiceObjectDelegate.myxRegistry);
               if (_equals_2) {
                 _builder.append("all service objects in the MyxRegistry of type ");
                 String _className_7 = i_1.getClassName();
                 _builder.append(_className_7, "	 ");
                 _builder.append(".");
               } else {
                 _builder.append("all connections on the interface");
               }
             }
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @see #");
             EMyxInterfaceDirection _direction_2 = i_1.getDirection();
             String _name_13 = _direction_2.name();
             String _lowerCase_2 = _name_13.toLowerCase();
             String _name_14 = i_1.getName();
             String _firstUpper_2 = StringExtensions.toFirstUpper(_name_14);
             String _plus_2 = (_lowerCase_2 + _firstUpper_2);
             String _constantName_2 = MyxCompUtils.toConstantName(_plus_2);
             _builder.append(_constantName_2, "	");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @generated");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("*/");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("protected final ");
             String _className_8 = i_1.getClassName();
             _builder.append(_className_8, "	");
             _builder.append(" ");
             String _name_15 = i_1.getName();
             _builder.append(_name_15, "	");
             _builder.append("Proxy =");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("(");
             String _className_9 = i_1.getClassName();
             _builder.append(_className_9, "		");
             _builder.append(") java.lang.reflect.Proxy.newProxyInstance(");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             String _className_10 = i_1.getClassName();
             _builder.append(_className_10, "			");
             _builder.append(".class.getClassLoader(), ");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("new Class[] { ");
             String _className_11 = i_1.getClassName();
             _builder.append(_className_11, "			");
             _builder.append(".class },");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("new java.lang.reflect.InvocationHandler() {");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append("@Override");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append(
                 "public Object invoke(Object proxy, java.lang.reflect.Method method, Object[] args) throws Throwable {");
             _builder.newLine();
             {
               EServiceObjectDelegate _serviceObjectDelegate_3 = i_1.getServiceObjectDelegate();
               boolean _equals_3 =
                   Objects.equal(_serviceObjectDelegate_3, EServiceObjectDelegate.myxRegistry);
               if (_equals_3) {
                 _builder.append("\t");
                 _builder.append("\t\t\t\t");
                 _builder.append("for (");
                 String _className_12 = i_1.getClassName();
                 _builder.append(_className_12, "					");
                 _builder.append(" o : myxRegistry.getObjects(");
                 String _stubClassName_2 = b.getStubClassName();
                 String _className_13 = MyxCompUtils.toClassName(_stubClassName_2);
                 _builder.append(_className_13, "					");
                 _builder.append(".this, ");
                 String _className_14 = i_1.getClassName();
                 _builder.append(_className_14, "					");
                 _builder.append(".class)) {");
                 _builder.newLineIfNotEmpty();
               } else {
                 boolean _isSingle_2 = i_1.isSingle();
                 boolean _not_1 = (!_isSingle_2);
                 if (_not_1) {
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("for (");
                   String _className_15 = i_1.getClassName();
                   _builder.append(_className_15, "					");
                   _builder.append(" o : ");
                   String _name_16 = i_1.getName();
                   _builder.append(_name_16, "					");
                   _builder.append(") {");
                   _builder.newLineIfNotEmpty();
                 } else {
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   String _className_16 = i_1.getClassName();
                   _builder.append(_className_16, "					");
                   _builder.append(" o = ");
                   String _name_17 = i_1.getName();
                   _builder.append(_name_17, "					");
                   _builder.append(";");
                   _builder.newLineIfNotEmpty();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("if (o == null) {");
                   _builder.newLine();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("\t");
                   _builder.append("throw new NullPointerException(\"");
                   String _name_18 = i_1.getName();
                   _builder.append(_name_18, "						");
                   _builder.append("\");");
                   _builder.newLineIfNotEmpty();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("}");
                   _builder.newLine();
                   _builder.append("\t");
                   _builder.append("\t\t\t\t");
                   _builder.append("else {");
                   _builder.newLine();
                 }
               }
             }
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("try {");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t\t");
             _builder.append("method.invoke(o, args);");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("catch (Exception e) {");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t\t");
             _builder.append("e.printStackTrace();");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append("return null;");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t\t\t");
             _builder.append("}");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("});");
             _builder.newLine();
           }
         }
         _builder.newLine();
         {
           boolean _isGenerateGetter = i_1.isGenerateGetter();
           if (_isGenerateGetter) {
             _builder.append("\t");
             _builder.append("/**");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("* Returns the service object(s) for the ");
             String _name_19 = i_1.getName();
             _builder.append(_name_19, "	");
             _builder.append(" interface.");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @see #");
             EMyxInterfaceDirection _direction_3 = i_1.getDirection();
             String _name_20 = _direction_3.name();
             String _lowerCase_3 = _name_20.toLowerCase();
             String _name_21 = i_1.getName();
             String _firstUpper_3 = StringExtensions.toFirstUpper(_name_21);
             String _plus_3 = (_lowerCase_3 + _firstUpper_3);
             String _constantName_3 = MyxCompUtils.toConstantName(_plus_3);
             _builder.append(_constantName_3, "	");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("* @generated");
             _builder.newLine();
             _builder.append("\t");
             _builder.append("*/");
             _builder.newLine();
             {
               EServiceObjectDelegate _serviceObjectDelegate_4 = i_1.getServiceObjectDelegate();
               boolean _isNeedsProxy_1 = _serviceObjectDelegate_4.isNeedsProxy();
               if (_isNeedsProxy_1) {
                 _builder.append("\t");
                 _builder.append("public ");
                 String _className_17 = i_1.getClassName();
                 _builder.append(_className_17, "	");
                 _builder.append(" get");
                 String _name_22 = i_1.getName();
                 String _firstUpper_4 = StringExtensions.toFirstUpper(_name_22);
                 _builder.append(_firstUpper_4, "	");
                 _builder.append("() {");
                 _builder.newLineIfNotEmpty();
               } else {
                 _builder.append("\t");
                 _builder.append("public ");
                 {
                   boolean _isSingle_3 = i_1.isSingle();
                   if (_isSingle_3) {
                     String _className_18 = i_1.getClassName();
                     _builder.append(_className_18, "	");
                   } else {
                     _builder.append("java.util.Collection<");
                     String _className_19 = i_1.getClassName();
                     _builder.append(_className_19, "	");
                     _builder.append(">");
                   }
                 }
                 _builder.append(" get");
                 String _name_23 = i_1.getName();
                 String _firstUpper_5 = StringExtensions.toFirstUpper(_name_23);
                 _builder.append(_firstUpper_5, "	");
                 _builder.append("() {");
                 _builder.newLineIfNotEmpty();
               }
             }
             {
               EServiceObjectDelegate _serviceObjectDelegate_5 = i_1.getServiceObjectDelegate();
               boolean _equals_4 =
                   Objects.equal(_serviceObjectDelegate_5, EServiceObjectDelegate.brick);
               if (_equals_4) {
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("return this;");
                 _builder.newLine();
               } else {
                 {
                   boolean _and = false;
                   EServiceObjectDelegate _serviceObjectDelegate_6 =
                       i_1.getServiceObjectDelegate();
                   boolean _isNeedsProxy_2 = _serviceObjectDelegate_6.isNeedsProxy();
                   boolean _not_2 = (!_isNeedsProxy_2);
                   if (!_not_2) {
                     _and = false;
                   } else {
                     boolean _isSingle_4 = i_1.isSingle();
                     _and = (_not_2 && _isSingle_4);
                   }
                   if (_and) {
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append("if (");
                     String _name_24 = i_1.getName();
                     _builder.append(_name_24, "		");
                     _builder.append(" == null) {");
                     _builder.newLineIfNotEmpty();
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append(
                         "throw new NullPointerException(\"Uninitialized service object: ");
                     String _name_25 = i_1.getName();
                     _builder.append(_name_25, "			");
                     _builder.append("\");");
                     _builder.newLineIfNotEmpty();
                     _builder.append("\t");
                     _builder.append("\t");
                     _builder.append("}");
                     _builder.newLine();
                   }
                 }
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("return ");
                 String _name_26 = i_1.getName();
                 _builder.append(_name_26, "		");
                 {
                   EServiceObjectDelegate _serviceObjectDelegate_7 =
                       i_1.getServiceObjectDelegate();
                   boolean _isNeedsProxy_3 = _serviceObjectDelegate_7.isNeedsProxy();
                   if (_isNeedsProxy_3) {
                     _builder.append("Proxy");
                   }
                 }
                 _builder.append(";");
                 _builder.newLineIfNotEmpty();
               }
             }
             _builder.append("\t");
             _builder.append("}");
             _builder.newLine();
           }
         }
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("* Returns service object(s) for IN interfaces.");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_3 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_1 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.IN);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_1 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_3, _function_1);
       for (final MyxGenInterface i_2 : _filter_1) {
         _builder.append("\t");
         _builder.append("* @see #");
         EMyxInterfaceDirection _direction_4 = i_2.getDirection();
         String _name_27 = _direction_4.name();
         String _lowerCase_4 = _name_27.toLowerCase();
         String _name_28 = i_2.getName();
         String _firstUpper_6 = StringExtensions.toFirstUpper(_name_28);
         String _plus_4 = (_lowerCase_4 + _firstUpper_6);
         String _constantName_4 = MyxCompUtils.toConstantName(_plus_4);
         _builder.append(_constantName_4, "	");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("\t");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("public Object getServiceObject(IMyxName interfaceName) {");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_4 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_2 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.IN);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_2 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_4, _function_2);
       for (final MyxGenInterface i_3 : _filter_2) {
         _builder.append("\t");
         _builder.append("if(interfaceName.equals(");
         EMyxInterfaceDirection _direction_5 = i_3.getDirection();
         String _name_29 = _direction_5.name();
         String _lowerCase_5 = _name_29.toLowerCase();
         String _name_30 = i_3.getName();
         String _firstUpper_7 = StringExtensions.toFirstUpper(_name_30);
         String _plus_5 = (_lowerCase_5 + _firstUpper_7);
         String _constantName_5 = MyxCompUtils.toConstantName(_plus_5);
         _builder.append(_constantName_5, "	");
         _builder.append(")) {");
         _builder.newLineIfNotEmpty();
         {
           EServiceObjectDelegate _serviceObjectDelegate_8 = i_3.getServiceObjectDelegate();
           boolean _equals_5 =
               Objects.equal(_serviceObjectDelegate_8, EServiceObjectDelegate.brick);
           if (_equals_5) {
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("return this;");
             _builder.newLine();
           } else {
             {
               boolean _and_1 = false;
               EServiceObjectDelegate _serviceObjectDelegate_9 = i_3.getServiceObjectDelegate();
               boolean _isNeedsProxy_4 = _serviceObjectDelegate_9.isNeedsProxy();
               boolean _not_3 = (!_isNeedsProxy_4);
               if (!_not_3) {
                 _and_1 = false;
               } else {
                 boolean _isSingle_5 = i_3.isSingle();
                 _and_1 = (_not_3 && _isSingle_5);
               }
               if (_and_1) {
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("if (");
                 String _name_31 = i_3.getName();
                 _builder.append(_name_31, "		");
                 _builder.append(" == null) {");
                 _builder.newLineIfNotEmpty();
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append(
                     "throw new NullPointerException(\"Uninitialized service object: ");
                 String _name_32 = i_3.getName();
                 _builder.append(_name_32, "			");
                 _builder.append("\");");
                 _builder.newLineIfNotEmpty();
                 _builder.append("\t");
                 _builder.append("\t");
                 _builder.append("}");
                 _builder.newLine();
               }
             }
             _builder.append("\t");
             _builder.append("\t");
             _builder.append("return ");
             String _name_33 = i_3.getName();
             _builder.append(_name_33, "		");
             {
               EServiceObjectDelegate _serviceObjectDelegate_10 = i_3.getServiceObjectDelegate();
               boolean _isNeedsProxy_5 = _serviceObjectDelegate_10.isNeedsProxy();
               if (_isNeedsProxy_5) {
                 _builder.append("Proxy");
               }
             }
             _builder.append(";");
             _builder.newLineIfNotEmpty();
           }
         }
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     {
       String _parentBrickId_1 = b.getParentBrickId();
       boolean _equals_6 = Objects.equal(_parentBrickId_1, null);
       if (_equals_6) {
         _builder.append("\t");
         _builder.append(
             "throw new IllegalArgumentException(\"Unhandled interface: \"+interfaceName.getName());");
         _builder.newLine();
       } else {
         _builder.append("\t");
         _builder.append("return super.getServiceObject(interfaceName);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("* Update service objects based on connected OUT interfaces.");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_5 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_3 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_3 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_5, _function_3);
       for (final MyxGenInterface i_4 : _filter_3) {
         _builder.append("\t");
         _builder.append("* @see #");
         EMyxInterfaceDirection _direction_6 = i_4.getDirection();
         String _name_34 = _direction_6.name();
         String _lowerCase_6 = _name_34.toLowerCase();
         String _name_35 = i_4.getName();
         String _firstUpper_8 = StringExtensions.toFirstUpper(_name_35);
         String _plus_6 = (_lowerCase_6 + _firstUpper_8);
         String _constantName_6 = MyxCompUtils.toConstantName(_plus_6);
         _builder.append(_constantName_6, "	");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("\t");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "public void interfaceConnected(IMyxName interfaceName, Object serviceObject) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("if (serviceObject == null)");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("throw new NullPointerException(interfaceName.getName());");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_6 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_4 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_4 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_6, _function_4);
       for (final MyxGenInterface i_5 : _filter_4) {
         _builder.newLine();
         _builder.append("\t");
         _builder.append("if(interfaceName.equals(");
         EMyxInterfaceDirection _direction_7 = i_5.getDirection();
         String _name_36 = _direction_7.name();
         String _lowerCase_7 = _name_36.toLowerCase();
         String _name_37 = i_5.getName();
         String _firstUpper_9 = StringExtensions.toFirstUpper(_name_37);
         String _plus_7 = (_lowerCase_7 + _firstUpper_9);
         String _constantName_7 = MyxCompUtils.toConstantName(_plus_7);
         _builder.append(_constantName_7, "	");
         _builder.append(")) {");
         _builder.newLineIfNotEmpty();
         {
           boolean _isSingle_6 = i_5.isSingle();
           if (_isSingle_6) {
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("if (");
             String _name_38 = i_5.getName();
             _builder.append(_name_38, "			");
             _builder.append(" != null)");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("\t");
             _builder.append(
                 "throw new IllegalStateException(\"Only a single connection is supported on interface: ");
             String _name_39 = i_5.getName();
             _builder.append(_name_39, "				");
             _builder.append("\");");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_40 = i_5.getName();
             _builder.append(_name_40, "			");
             _builder.append(" = (");
             String _className_20 = i_5.getClassName();
             _builder.append(_className_20, "			");
             _builder.append(") serviceObject;");
             _builder.newLineIfNotEmpty();
           } else {
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_41 = i_5.getName();
             _builder.append(_name_41, "			");
             _builder.append(".add((");
             String _className_21 = i_5.getClassName();
             _builder.append(_className_21, "			");
             _builder.append(") serviceObject);");
             _builder.newLineIfNotEmpty();
           }
         }
         _builder.append("\t");
         _builder.append("\t\t");
         _builder.append("return;");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     {
       String _parentBrickId_2 = b.getParentBrickId();
       boolean _equals_7 = Objects.equal(_parentBrickId_2, null);
       if (_equals_7) {
         _builder.append("\t");
         _builder.append(
             "throw new IllegalArgumentException(\"Unhandled interface: \"+interfaceName.getName());");
         _builder.newLine();
       } else {
         _builder.append("\t");
         _builder.append("super.interfaceConnected(interfaceName, serviceObject);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("* Update service objects based on disconnecting OUT interfaces.");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_7 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_5 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_5 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_7, _function_5);
       for (final MyxGenInterface i_6 : _filter_5) {
         _builder.append("\t");
         _builder.append("* @see #");
         EMyxInterfaceDirection _direction_8 = i_6.getDirection();
         String _name_42 = _direction_8.name();
         String _lowerCase_8 = _name_42.toLowerCase();
         String _name_43 = i_6.getName();
         String _firstUpper_10 = StringExtensions.toFirstUpper(_name_43);
         String _plus_8 = (_lowerCase_8 + _firstUpper_10);
         String _constantName_8 = MyxCompUtils.toConstantName(_plus_8);
         _builder.append(_constantName_8, "	");
         _builder.newLineIfNotEmpty();
       }
     }
     _builder.append("\t");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "public void interfaceDisconnecting(IMyxName interfaceName, Object serviceObject) {");
     _builder.newLine();
     _builder.append("\t\t");
     _builder.append("if (serviceObject == null)");
     _builder.newLine();
     _builder.append("\t\t\t");
     _builder.append("throw new NullPointerException(interfaceName.getName());");
     _builder.newLine();
     {
       Collection<MyxGenInterface> _interfaces_8 = b.getInterfaces();
       final Function1<MyxGenInterface, Boolean> _function_6 =
           new Function1<MyxGenInterface, Boolean>() {
             public Boolean apply(final MyxGenInterface i) {
               EMyxInterfaceDirection _direction = i.getDirection();
               boolean _equals = Objects.equal(_direction, EMyxInterfaceDirection.OUT);
               return Boolean.valueOf(_equals);
             }
           };
       Iterable<MyxGenInterface> _filter_6 =
           IterableExtensions.<MyxGenInterface>filter(_interfaces_8, _function_6);
       for (final MyxGenInterface i_7 : _filter_6) {
         _builder.newLine();
         _builder.append("\t");
         _builder.append("if(interfaceName.equals(");
         EMyxInterfaceDirection _direction_9 = i_7.getDirection();
         String _name_44 = _direction_9.name();
         String _lowerCase_9 = _name_44.toLowerCase();
         String _name_45 = i_7.getName();
         String _firstUpper_11 = StringExtensions.toFirstUpper(_name_45);
         String _plus_9 = (_lowerCase_9 + _firstUpper_11);
         String _constantName_9 = MyxCompUtils.toConstantName(_plus_9);
         _builder.append(_constantName_9, "	");
         _builder.append(")) {");
         _builder.newLineIfNotEmpty();
         {
           boolean _isSingle_7 = i_7.isSingle();
           if (_isSingle_7) {
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("if (");
             String _name_46 = i_7.getName();
             _builder.append(_name_46, "			");
             _builder.append(" == null)");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             _builder.append("\t");
             _builder.append(
                 "throw new IllegalStateException(\"A connection was never made on interface: ");
             String _name_47 = i_7.getName();
             _builder.append(_name_47, "				");
             _builder.append("\");");
             _builder.newLineIfNotEmpty();
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_48 = i_7.getName();
             _builder.append(_name_48, "			");
             _builder.append(" = null;");
             _builder.newLineIfNotEmpty();
           } else {
             _builder.append("\t");
             _builder.append("\t\t");
             String _name_49 = i_7.getName();
             _builder.append(_name_49, "			");
             _builder.append(".remove(serviceObject);");
             _builder.newLineIfNotEmpty();
           }
         }
         _builder.append("\t");
         _builder.append("\t\t");
         _builder.append("return;");
         _builder.newLine();
         _builder.append("\t");
         _builder.append("}");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.newLine();
     {
       String _parentBrickId_3 = b.getParentBrickId();
       boolean _equals_8 = Objects.equal(_parentBrickId_3, null);
       if (_equals_8) {
         _builder.append("\t");
         _builder.append(
             "throw new IllegalArgumentException(\"Unhandled interface: \"+interfaceName.getName());");
         _builder.newLine();
       } else {
         _builder.append("\t");
         _builder.append("super.interfaceDisconnecting(interfaceName, serviceObject);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.newLine();
     _builder.append("\t");
     _builder.append("/**");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("* Performs no operation upon the completion of an interface disconnecting.");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("* @generated");
     _builder.newLine();
     _builder.append("\t ");
     _builder.append("*/");
     _builder.newLine();
     _builder.append("\t");
     _builder.append("@Override");
     _builder.newLine();
     _builder.append("\t");
     _builder.append(
         "public void interfaceDisconnected(IMyxName interfaceName, Object serviceObject) {");
     _builder.newLine();
     {
       String _parentBrickId_4 = b.getParentBrickId();
       boolean _notEquals_3 = (!Objects.equal(_parentBrickId_4, null));
       if (_notEquals_3) {
         _builder.append("\t");
         _builder.append("super.interfaceDisconnected(interfaceName, serviceObject);");
         _builder.newLine();
       }
     }
     _builder.append("\t");
     _builder.append("}");
     _builder.newLine();
     _builder.append("}");
     _builder.newLine();
     return _builder.toString();
   } catch (Throwable _e) {
     throw Exceptions.sneakyThrow(_e);
   }
 }
Ejemplo n.º 16
0
 protected Object _execute(final Step step) {
   String _operator_plus = StringExtensions.operator_plus("Missing dispatch function for ", step);
   String _println = InputOutput.<String>println(_operator_plus);
   return _println;
 }
 @Override
 public ContentAssistEntry createProposal(
     final IEObjectDescription candidate,
     final CrossReference crossRef,
     final ContentAssistContext context) {
   boolean _hasIdRule = this.hasIdRule(crossRef);
   if (_hasIdRule) {
     final XbaseIdeCrossrefProposalProvider.ProposalBracketInfo bracketInfo =
         this.getProposalBracketInfo(candidate, context);
     IQualifiedNameConverter _qualifiedNameConverter = this.getQualifiedNameConverter();
     QualifiedName _name = candidate.getName();
     String _string = _qualifiedNameConverter.toString(_name);
     final String proposalString = (_string + bracketInfo.brackets);
     int insignificantParameters = 0;
     if ((candidate instanceof IIdentifiableElementDescription)) {
       int _numberOfIrrelevantParameters =
           ((IIdentifiableElementDescription) candidate).getNumberOfIrrelevantParameters();
       insignificantParameters = _numberOfIrrelevantParameters;
     }
     XtextResource _resource = context.getResource();
     final LightweightTypeReferenceFactory converter = this.getTypeConverter(_resource);
     final EObject objectOrProxy = candidate.getEObjectOrProxy();
     ContentAssistEntry _contentAssistEntry = new ContentAssistEntry();
     final Procedure1<ContentAssistEntry> _function =
         new Procedure1<ContentAssistEntry>() {
           @Override
           public void apply(final ContentAssistEntry it) {
             String _prefix = context.getPrefix();
             it.setPrefix(_prefix);
             it.setProposal(proposalString);
           }
         };
     final ContentAssistEntry result =
         ObjectExtensions.<ContentAssistEntry>operator_doubleArrow(_contentAssistEntry, _function);
     if ((objectOrProxy instanceof JvmFeature)) {
       boolean _startsWith = bracketInfo.brackets.startsWith(" =");
       if (_startsWith) {
         IQualifiedNameConverter _qualifiedNameConverter_1 = this.getQualifiedNameConverter();
         QualifiedName _name_1 = candidate.getName();
         String _string_1 = _qualifiedNameConverter_1.toString(_name_1);
         String _plus = (_string_1 + bracketInfo.brackets);
         this.addNameAndDescription(
             result,
             ((JvmFeature) objectOrProxy),
             false,
             insignificantParameters,
             _plus,
             converter);
       } else {
         boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(bracketInfo.brackets);
         boolean _not = (!_isNullOrEmpty);
         IQualifiedNameConverter _qualifiedNameConverter_2 = this.getQualifiedNameConverter();
         QualifiedName _name_2 = candidate.getName();
         String _string_2 = _qualifiedNameConverter_2.toString(_name_2);
         this.addNameAndDescription(
             result,
             ((JvmFeature) objectOrProxy),
             _not,
             insignificantParameters,
             _string_2,
             converter);
       }
     } else {
       IQualifiedNameConverter _qualifiedNameConverter_3 = this.getQualifiedNameConverter();
       QualifiedName _qualifiedName = candidate.getQualifiedName();
       String _string_3 = _qualifiedNameConverter_3.toString(_qualifiedName);
       IQualifiedNameConverter _qualifiedNameConverter_4 = this.getQualifiedNameConverter();
       QualifiedName _name_3 = candidate.getName();
       String _string_4 = _qualifiedNameConverter_4.toString(_name_3);
       this.addNameAndDescription(result, objectOrProxy, _string_3, _string_4);
     }
     int _offset = context.getOffset();
     String _prefix = context.getPrefix();
     int _length = _prefix.length();
     int _minus = (_offset - _length);
     int _length_1 = proposalString.length();
     int offset = (_minus + _length_1);
     result.setEscapePosition(Integer.valueOf((offset + bracketInfo.caretOffset)));
     if ((bracketInfo.selectionOffset != 0)) {
       int _offset_1 = offset;
       offset = (_offset_1 + bracketInfo.selectionOffset);
       ArrayList<TextRegion> _editPositions = result.getEditPositions();
       TextRegion _textRegion = new TextRegion(offset, bracketInfo.selectionLength);
       _editPositions.add(_textRegion);
     }
     if ((objectOrProxy instanceof JvmExecutable)) {
       final StringBuilder parameterList = new StringBuilder();
       this.appendParameters(
           parameterList, ((JvmExecutable) objectOrProxy), insignificantParameters, converter);
     }
     return result;
   }
   return super.createProposal(candidate, crossRef, context);
 }