gt:           String _plus_26 = (_plus_25 + "pt");
context: /**
   * Copyright (c) 2015 Niksa Visic.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
   * which accompanies this distribution, and is available at
   * http://www.eclipse.org/legal/epl-v10.html
   */
  package org.xtext.nv.dsl.generator;
  
  import com.google.common.base.Objects;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Date;
  import java.util.Random;
  import org.eclipse.emf.common.util.EList;
  import org.eclipse.emf.common.util.URI;
  import org.eclipse.emf.ecore.EObject;
  import org.eclipse.emf.ecore.resource.Resource;
  import org.eclipse.xtend2.lib.StringConcatenation;
  import org.eclipse.xtext.generator.IFileSystemAccess;
  import org.eclipse.xtext.generator.IGenerator;
  import org.eclipse.xtext.xbase.lib.CollectionExtensions;
  import org.eclipse.xtext.xbase.lib.Exceptions;
  import org.eclipse.xtext.xbase.lib.ExclusiveRange;
  import org.eclipse.xtext.xbase.lib.IntegerRange;
  import org.eclipse.xtext.xbase.lib.IterableExtensions;
  import org.xtext.nv.dsl.mMDSL.AccessType;
  import org.xtext.nv.dsl.mMDSL.Algorithm;
  import org.xtext.nv.dsl.mMDSL.AlgorithmOperation;
  import org.xtext.nv.dsl.mMDSL.Attribute;
  import org.xtext.nv.dsl.mMDSL.AttributeGet;
  import org.xtext.nv.dsl.mMDSL.AttributeOperation;
  import org.xtext.nv.dsl.mMDSL.AttributeSet;
  import org.xtext.nv.dsl.mMDSL.ButtonType;
  import org.xtext.nv.dsl.mMDSL.Circle;
  import org.xtext.nv.dsl.mMDSL.ClassAttribute;
  import org.xtext.nv.dsl.mMDSL.ClassInstanceCreate;
  import org.xtext.nv.dsl.mMDSL.ClassInstanceDelete;
  import org.xtext.nv.dsl.mMDSL.ClassInstanceGet;
  import org.xtext.nv.dsl.mMDSL.ClassInstanceGetAll;
  import org.xtext.nv.dsl.mMDSL.ClassInstanceSet;
  import org.xtext.nv.dsl.mMDSL.Color;
  import org.xtext.nv.dsl.mMDSL.ContextItem;
  import org.xtext.nv.dsl.mMDSL.DirCreate;
  import org.xtext.nv.dsl.mMDSL.DirDelete;
  import org.xtext.nv.dsl.mMDSL.DirGetWorking;
  import org.xtext.nv.dsl.mMDSL.DirList;
  import org.xtext.nv.dsl.mMDSL.DirOperation;
  import org.xtext.nv.dsl.mMDSL.DirSetWorking;
  import org.xtext.nv.dsl.mMDSL.EditBox;
  import org.xtext.nv.dsl.mMDSL.Ellipse;
  import org.xtext.nv.dsl.mMDSL.EmbedCode;
  import org.xtext.nv.dsl.mMDSL.EnumType;
  import org.xtext.nv.dsl.mMDSL.Enumeration;
  import org.xtext.nv.dsl.mMDSL.ErrorBox;
  import org.xtext.nv.dsl.mMDSL.FileCopy;
  import org.xtext.nv.dsl.mMDSL.FileCreate;
  import org.xtext.nv.dsl.mMDSL.FileDelete;
  import org.xtext.nv.dsl.mMDSL.FileOperation;
  import org.xtext.nv.dsl.mMDSL.FileRead;
  import org.xtext.nv.dsl.mMDSL.FileWrite;
  import org.xtext.nv.dsl.mMDSL.FillColor;
  import org.xtext.nv.dsl.mMDSL.ForLoop;
  import org.xtext.nv.dsl.mMDSL.InfoBox;
  import org.xtext.nv.dsl.mMDSL.InsertContextItem;
  import org.xtext.nv.dsl.mMDSL.InsertEmbedCode;
  import org.xtext.nv.dsl.mMDSL.InsertMenuItem;
  import org.xtext.nv.dsl.mMDSL.InstanceOperation;
  import org.xtext.nv.dsl.mMDSL.ItemOperation;
  import org.xtext.nv.dsl.mMDSL.Line;
  import org.xtext.nv.dsl.mMDSL.LoopStatement;
  import org.xtext.nv.dsl.mMDSL.MenuItem;
  import org.xtext.nv.dsl.mMDSL.Metamodel;
  import org.xtext.nv.dsl.mMDSL.Method;
  import org.xtext.nv.dsl.mMDSL.MethodName;
  import org.xtext.nv.dsl.mMDSL.Mode;
  import org.xtext.nv.dsl.mMDSL.ModelCreate;
  import org.xtext.nv.dsl.mMDSL.ModelDelete;
  import org.xtext.nv.dsl.mMDSL.ModelDiscard;
  import org.xtext.nv.dsl.mMDSL.ModelIsLoaded;
  import org.xtext.nv.dsl.mMDSL.ModelLoad;
  import org.xtext.nv.dsl.mMDSL.ModelOperation;
  import org.xtext.nv.dsl.mMDSL.ModelSave;
  import org.xtext.nv.dsl.mMDSL.ModelType;
  import org.xtext.nv.dsl.mMDSL.Path;
  import org.xtext.nv.dsl.mMDSL.Points;
  import org.xtext.nv.dsl.mMDSL.Polygon;
  import org.xtext.nv.dsl.mMDSL.Polyline;
  import org.xtext.nv.dsl.mMDSL.Rectangle;
  import org.xtext.nv.dsl.mMDSL.RefName;
  import org.xtext.nv.dsl.mMDSL.Reference;
  import org.xtext.nv.dsl.mMDSL.Relation;
  import org.xtext.nv.dsl.mMDSL.RelationInstanceCreate;
  import org.xtext.nv.dsl.mMDSL.RelationInstanceDelete;
  import org.xtext.nv.dsl.mMDSL.RelationInstanceGet;
  import org.xtext.nv.dsl.mMDSL.RelationInstanceGetAll;
  import org.xtext.nv.dsl.mMDSL.RelationInstanceSet;
  import org.xtext.nv.dsl.mMDSL.RemoveMenuItem;
  import org.xtext.nv.dsl.mMDSL.Root;
  import org.xtext.nv.dsl.mMDSL.SVGCommand;
  import org.xtext.nv.dsl.mMDSL.SelectionStatement;
  import org.xtext.nv.dsl.mMDSL.SimpleType;
  import org.xtext.nv.dsl.mMDSL.SimpleUI;
  import org.xtext.nv.dsl.mMDSL.Statement;
  import org.xtext.nv.dsl.mMDSL.StrokeColor;
  import org.xtext.nv.dsl.mMDSL.SymbolClass;
  import org.xtext.nv.dsl.mMDSL.SymbolRelation;
  import org.xtext.nv.dsl.mMDSL.SymbolStyle;
  import org.xtext.nv.dsl.mMDSL.Text;
  import org.xtext.nv.dsl.mMDSL.Type;
  import org.xtext.nv.dsl.mMDSL.Variable;
  import org.xtext.nv.dsl.mMDSL.ViewBox;
  import org.xtext.nv.dsl.mMDSL.WarningBox;
  import org.xtext.nv.dsl.mMDSL.WhileLoop;
  
  /**
   * Generates code from your model files on save.
   * 
   * see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration
   */
  @SuppressWarnings("all")
  public class MMDSLGenerator implements IGenerator {
    public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
      String _className = this.className(resource);
      String _plus = (_className + "_output.all");
      EList<EObject> _contents = resource.getContents();
      EObject _head = IterableExtensions.<EObject>head(_contents);
      CharSequence _aLLcode = this.toALLcode(((Root) _head));
      fsa.generateFile(_plus, _aLLcode);
    }
    
    public String className(final Resource res) {
      URI _uRI = res.getURI();
      String name = _uRI.lastSegment();
      int _indexOf = name.indexOf(".");
      return name.substring(0, _indexOf);
    }
    
    public CharSequence toEnumValuesCode(final EList<String> enumvalues) {
      StringConcatenation _builder = new StringConcatenation();
      {
        for(final String v : enumvalues) {
          {
            int _lastIndexOf = enumvalues.lastIndexOf(v);
            int _size = enumvalues.size();
            int _minus = (_size - 1);
            boolean _equals = (_lastIndexOf == _minus);
            if (_equals) {
              _builder.append(v, "");
            } else {
              _builder.append(v, "");
              _builder.append("@");
            }
          }
        }
      }
      return _builder;
    }
    
    public CharSequence toTypeInt() {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("TYPE INTEGER");
      _builder.newLine();
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <MultiLineString>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeHelpText>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeRegularExpression>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeNumericDomain>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.append("\t");
      _builder.newLine();
      return _builder;
    }
    
    public CharSequence toTypeDouble() {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("TYPE DOUBLE");
      _builder.newLine();
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <MultiLineString>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeHelpText>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeRegularExpression>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeNumericDomain>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.append("\t");
      _builder.newLine();
      return _builder;
    }
    
    public CharSequence toTypeString() {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("TYPE STRING");
      _builder.newLine();
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <MultiLineString>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeHelpText>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeRegularExpression>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.append("\t");
      _builder.newLine();
      return _builder;
    }
    
    public CharSequence toTypeEnum(final ClassAttribute ca) {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("TYPE ENUMERATION");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <EnumerationDomain>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"");
      Type _type = ca.getType();
      EnumType _enumtype = _type.getEnumtype();
      Enumeration _name = _enumtype.getName();
      EList<String> _enumvalues = _name.getEnumvalues();
      CharSequence _enumValuesCode = this.toEnumValuesCode(_enumvalues);
      _builder.append(_enumValuesCode, "	");
      _builder.append("\"");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <MultiLineString>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeHelpText>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeRegularExpression>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("CLASSATTRIBUTE <");
      String _name_1 = ca.getName();
      _builder.append(_name_1, "");
      _builder.append(">");
      _builder.newLineIfNotEmpty();
      _builder.append("VALUE \"");
      Type _type_1 = ca.getType();
      EnumType _enumtype_1 = _type_1.getEnumtype();
      Enumeration _name_2 = _enumtype_1.getName();
      EList<String> _enumvalues_1 = _name_2.getEnumvalues();
      String _get = _enumvalues_1.get(0);
      _builder.append(_get, "");
      _builder.append("\"");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      return _builder;
    }
    
    public CharSequence toTypeEnum(final Attribute a) {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("TYPE ENUMERATION");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <EnumerationDomain>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"");
      Type _type = a.getType();
      EnumType _enumtype = _type.getEnumtype();
      Enumeration _name = _enumtype.getName();
      EList<String> _enumvalues = _name.getEnumvalues();
      CharSequence _enumValuesCode = this.toEnumValuesCode(_enumvalues);
      _builder.append(_enumValuesCode, "	");
      _builder.append("\"");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <MultiLineString>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeHelpText>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeRegularExpression>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("ATTRIBUTE <");
      String _name_1 = a.getName();
      _builder.append(_name_1, "");
      _builder.append(">");
      _builder.newLineIfNotEmpty();
      _builder.append("VALUE \"");
      Type _type_1 = a.getType();
      EnumType _enumtype_1 = _type_1.getEnumtype();
      Enumeration _name_2 = _enumtype_1.getName();
      EList<String> _enumvalues_1 = _name_2.getEnumvalues();
      String _get = _enumvalues_1.get(0);
      _builder.append(_get, "");
      _builder.append("\"");
      _builder.newLineIfNotEmpty();
      return _builder;
    }
    
    public CharSequence toReference(final Reference ref) {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("ATTRIBUTE <");
      String _name = ref.getName();
      _builder.append(_name, "");
      _builder.append(">");
      _builder.newLineIfNotEmpty();
      _builder.append("TYPE INTERREF");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <MultiLineString>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE 0");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeHelpText>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeRegularExpression>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"\"");
      _builder.newLine();
      _builder.newLine();
      _builder.append("\t");
      _builder.append("FACET <AttributeInterRefDomain>");
      _builder.newLine();
      _builder.append("\t");
      _builder.append("VALUE \"REFDOMAIN");
      _builder.newLine();
      _builder.append("\t");
      {
        RefName _refname = ref.getRefname();
        org.xtext.nv.dsl.mMDSL.Class _classname = _refname.getClassname();
        boolean _equals = Objects.equal(_classname, null);
        if (_equals) {
          _builder.append("MODREF");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("mt:\\\"");
          RefName _refname_1 = ref.getRefname();
          ModelType _modeltypename = _refname_1.getModeltypename();
          String _name_1 = _modeltypename.getName();
          _builder.append(_name_1, "	");
          _builder.append("\\\"");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
        } else {
          _builder.append("OBJREF");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("mt:\\\"");
          RefName _refname_2 = ref.getRefname();
          ModelType _modeltypename_1 = _refname_2.getModeltypename();
          String _name_2 = _modeltypename_1.getName();
          _builder.append(_name_2, "	");
          _builder.append("\\\"");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("c:\\\"");
          RefName _refname_3 = ref.getRefname();
          org.xtext.nv.dsl.mMDSL.Class _classname_1 = _refname_3.getClassname();
          String _name_3 = _classname_1.getName();
          _builder.append(_name_3, "	");
          _builder.append("\\\"");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
        }
      }
      _builder.append("\"");
      _builder.newLineIfNotEmpty();
      _builder.newLine();
      _builder.append("ATTRIBUTE <");
      String _name_4 = ref.getName();
      _builder.append(_name_4, "");
      _builder.append(">");
      _builder.newLineIfNotEmpty();
      _builder.append("VALUE \"\"");
      _builder.newLine();
      return _builder;
    }
    
    public String toNotebook(final org.xtext.nv.dsl.mMDSL.Class c) {
      String notebook = "";
      boolean _and = false;
      EList<Attribute> _attribute = c.getAttribute();
      boolean _isEmpty = _attribute.isEmpty();
      if (!_isEmpty) {
        _and = false;
      } else {
        EList<Reference> _reference = c.getReference();
        boolean _isEmpty_1 = _reference.isEmpty();
        _and = (_isEmpty && _isEmpty_1);
      }
      if (_and) {
        return notebook;
      }
      EList<Attribute> _attribute_1 = c.getAttribute();
      boolean _isEmpty_2 = _attribute_1.isEmpty();
      boolean _not = (!_isEmpty_2);
      if (_not) {
        EList<Attribute> _attribute_2 = c.getAttribute();
        int _size = _attribute_2.size();
        int _minus = (_size - 1);
        IntegerRange _upTo = new IntegerRange(0, _minus);
        for (final Integer i : _upTo) {
          {
            EList<Attribute> _attribute_3 = c.getAttribute();
            Attribute attr = _attribute_3.get((i).intValue());
            AccessType _access = attr.getAccess();
            boolean _equals = Objects.equal(_access, AccessType.WRITE);
            if (_equals) {
              String _plus = (notebook + "ATTR ");
              String _plus_1 = (_plus + "\\\"");
              String _name = attr.getName();
              String _plus_2 = (_plus_1 + _name);
              String _plus_3 = (_plus_2 + "\\\"");
              String _plus_4 = (_plus_3 + "\n");
              notebook = _plus_4;
            } else {
              AccessType _access_1 = attr.getAccess();
              boolean _equals_1 = Objects.equal(_access_1, AccessType.READ);
              if (_equals_1) {
                String _plus_5 = (notebook + "ATTR ");
                String _plus_6 = (_plus_5 + "\\\"");
                String _name_1 = attr.getName();
                String _plus_7 = (_plus_6 + _name_1);
                String _plus_8 = (_plus_7 + "\\\"");
                String _plus_9 = (_plus_8 + " write-protected");
                String _plus_10 = (_plus_9 + "\n");
                notebook = _plus_10;
              } else {
                String _plus_11 = (notebook + "#");
                String _plus_12 = (_plus_11 + "ATTR ");
                String _plus_13 = (_plus_12 + "\\\"");
                String _name_2 = attr.getName();
                String _plus_14 = (_plus_13 + _name_2);
                String _plus_15 = (_plus_14 + "\\\"");
                String _plus_16 = (_plus_15 + "\n");
                notebook = _plus_16;
              }
            }
          }
        }
      }
      EList<Reference> _reference_1 = c.getReference();
      boolean _isEmpty_3 = _reference_1.isEmpty();
      boolean _not_1 = (!_isEmpty_3);
      if (_not_1) {
        EList<Reference> _reference_2 = c.getReference();
        int _size_1 = _reference_2.size();
        int _minus_1 = (_size_1 - 1);
        IntegerRange _upTo_1 = new IntegerRange(0, _minus_1);
        for (final Integer i_1 : _upTo_1) {
          {
            EList<Reference> _reference_3 = c.getReference();
            Reference ref = _reference_3.get((i_1).intValue());
            String _plus = (notebook + "ATTR ");
            String _plus_1 = (_plus + "\\\"");
            String _name = ref.getName();
            String _plus_2 = (_plus_1 + _name);
            String _plus_3 = (_plus_2 + "\\\"");
            String _plus_4 = (_plus_3 + "\n");
            notebook = _plus_4;
          }
        }
      }
      return notebook;
    }
    
    /**
     * example: toNotebook(Car)
     * Car.attribute will contain: Name (per default), color, length, width, height, weight
     * attribute.access will be WRITE (all attributes are visible and values can be changed)
     */
    public String toNotebook(final Relation r) {
      String notebook = "";
      EList<Attribute> _attribute = r.getAttribute();
      boolean _isEmpty = _attribute.isEmpty();
      if (_isEmpty) {
        return notebook;
      }
      EList<Attribute> _attribute_1 = r.getAttribute();
      int _size = _attribute_1.size();
      int _minus = (_size - 1);
      IntegerRange _upTo = new IntegerRange(0, _minus);
      for (final Integer i : _upTo) {
        {
          EList<Attribute> _attribute_2 = r.getAttribute();
          Attribute attr = _attribute_2.get((i).intValue());
          AccessType _access = attr.getAccess();
          boolean _equals = Objects.equal(_access, AccessType.WRITE);
          if (_equals) {
            String _plus = (notebook + "ATTR ");
            String _plus_1 = (_plus + "\\\"");
            String _name = attr.getName();
            String _plus_2 = (_plus_1 + _name);
            String _plus_3 = (_plus_2 + "\\\"");
            String _plus_4 = (_plus_3 + "\n");
            notebook = _plus_4;
          } else {
            AccessType _access_1 = attr.getAccess();
            boolean _equals_1 = Objects.equal(_access_1, AccessType.READ);
            if (_equals_1) {
              String _plus_5 = (notebook + "ATTR ");
              String _plus_6 = (_plus_5 + "\\\"");
              String _name_1 = attr.getName();
              String _plus_7 = (_plus_6 + _name_1);
              String _plus_8 = (_plus_7 + "\\\"");
              String _plus_9 = (_plus_8 + " write-protected");
              String _plus_10 = (_plus_9 + "\n");
              notebook = _plus_10;
            } else {
              String _plus_11 = (notebook + "#");
              String _plus_12 = (_plus_11 + "ATTR ");
              String _plus_13 = (_plus_12 + "\\\"");
              String _name_2 = attr.getName();
              String _plus_14 = (_plus_13 + _name_2);
              String _plus_15 = (_plus_14 + "\\\"");
              String _plus_16 = (_plus_15 + "\n");
              notebook = _plus_16;
            }
          }
        }
      }
      return notebook;
    }
    
    public String RngColor() {
      Random _random = new Random();
      Random rand = _random;
      ArrayList<String> _arrayList = new ArrayList<String>();
      ArrayList<String> colors = _arrayList;
      CollectionExtensions.<String>addAll(colors, 
        "red", 
        "blue", 
        "green", 
        "yellow", 
        "pink", 
        "orange", 
        "silver", 
        "black", 
        "azure", 
        "aqua", 
        "coral", 
        "aqua", 
        "brown", 
        "gold", 
        "gray", 
        "navy", 
        "violet", 
        "darkblue", 
        "blueviolet", 
        "crimson");
      int colornum = rand.nextInt(19);
      return colors.get(colornum);
    }
    
    public String RngRectangle() {
      Random _random = new Random();
      Random rand = _random;
      int _nextInt = rand.nextInt(40);
      int rectsize = (_nextInt + 11);
      int _divide = (rectsize / 2);
      String _plus = ("RECTANGLE x:-" + Integer.valueOf(_divide));
      String _plus_1 = (_plus + "pt y:-");
      int _divide_1 = (rectsize / 2);
      String _plus_2 = (_plus_1 + Integer.valueOf(_divide_1));
      String _plus_3 = (_plus_2 + "pt h:");
      String _plus_4 = (_plus_3 + Integer.valueOf(rectsize));
      String _plus_5 = (_plus_4 + "pt w:");
      String _plus_6 = (_plus_5 + Integer.valueOf(rectsize));
      String rectangle = (_plus_6 + "pt");
      int _divide_2 = (rectsize / 2);
      int _plus_7 = (_divide_2 + 1);
      String _plus_8 = ("ATTR \\\"Name\\\" x:0pt y:" + Integer.valueOf(_plus_7));
      String name = (_plus_8 + "pt w:c");
      String _plus_9 = (rectangle + "\n");
      String command = (_plus_9 + name);
      return command;
    }
    
    public String RngEllipse() {
      Random _random = new Random();
      Random rand = _random;
      int _nextInt = rand.nextInt(40);
      int ellsizex = (_nextInt + 11);
      int _nextInt_1 = rand.nextInt(40);
      int ellsizey = (_nextInt_1 + 11);
      String _plus = ("ELLIPSE x:0pt y:0pt rx:" + Integer.valueOf(ellsizex));
      String _plus_1 = (_plus + "pt ry:");
      String _plus_2 = (_plus_1 + Integer.valueOf(ellsizey));
      String ellipse = (_plus_2 + "pt");
      int _plus_3 = (ellsizey + 1);
      String _plus_4 = ("ATTR \\\"Name\\\" x:0pt y:" + Integer.valueOf(_plus_3));
      String name = (_plus_4 + "pt w:c");
      String _plus_5 = (ellipse + "\n");
      String command = (_plus_5 + name);
      return command;
    }
    
    public String RngSymbol() {
      String _xblockexpression = null;
      {
        Random _random = new Random();
        Random rand = _random;
        int select = rand.nextInt(2);
        String _switchResult = null;
        boolean _matched = false;
        if (!_matched) {
          if (Objects.equal(select,0)) {
            _matched=true;
            String _RngEllipse = this.RngEllipse();
            _switchResult = _RngEllipse;
          }
        }
        if (!_matched) {
          String _RngRectangle = this.RngRectangle();
          _switchResult = _RngRectangle;
        }
        _xblockexpression = (_switchResult);
      }
      return _xblockexpression;
    }
    
    public CharSequence GenerateRandomClassSymbol() {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("PEN color:");
      String _RngColor = this.RngColor();
      _builder.append(_RngColor, "");
      _builder.append(" w:2pt");
      _builder.newLineIfNotEmpty();
      _builder.append("FILL color:");
      String _RngColor_1 = this.RngColor();
      _builder.append(_RngColor_1, "");
      _builder.newLineIfNotEmpty();
      String _RngSymbol = this.RngSymbol();
      _builder.append(_RngSymbol, "");
      return _builder;
    }
    
    public CharSequence GenerateRandomRelationSymobl() {
      StringConcatenation _builder = new StringConcatenation();
      _builder.append("PEN color:black w:1pt");
      _builder.newLine();
      _builder.append("FILL color:");
      String _RngColor = this.RngColor();
      _builder.append(_RngColor, "");
      _builder.newLineIfNotEmpty();
      _builder.append("START");
      _builder.newLine();
      _builder.append("#none");
      _builder.newLine();
      _builder.append("MIDDLE");
      _builder.newLine();
      _builder.append("#normal line");
      _builder.newLine();
      _builder.append("END");
      _builder.newLine();
      _builder.append("POLYGON 3 x1:-5pt y1:3pt x2:0pt y2:0pt x3:-5pt y3:-3pt");
      _builder.newLine();
      return _builder;
    }
    
    public String InsertCodeSnippet(final EmbedCode ec) {
      return ec.getEmbeddedcode();
    }
    
    public int toGraphRepCoordinate(final int svgx) {
      int _minus = (-svgx);
      return (_minus / 2);
    }
    
    public String defaultStyle() {
      String pen = "PEN color:black w:1pt\n";
      String fill = "FILL color:black\n";
      return (pen + fill);
    }
    
    public String applyStyle(final SymbolStyle ss) {
      String command = "";
      boolean _equals = Objects.equal(ss, null);
      if (_equals) {
        return command;
      }
      StrokeColor _strokecolor = ss.getStrokecolor();
      String _hexcolor = _strokecolor.getHexcolor();
      boolean _notEquals = (!Objects.equal(_hexcolor, null));
      if (_notEquals) {
        String _plus = ("PEN color:" + command);
        StrokeColor _strokecolor_1 = ss.getStrokecolor();
        String _hexcolor_1 = _strokecolor_1.getHexcolor();
        String _graphRepColor = this.toGraphRepColor(_hexcolor_1);
        String _plus_1 = (_plus + _graphRepColor);
        command = _plus_1;
      } else {
        String _plus_2 = ("PEN color:" + command);
        StrokeColor _strokecolor_2 = ss.getStrokecolor();
        Color _color = _strokecolor_2.getColor();
        String _plus_3 = (_plus_2 + _color);
        command = _plus_3;
      }
      String _plus_4 = (command + " w:");
      String _strokewidth = ss.getStrokewidth();
      String _plus_5 = (_plus_4 + _strokewidth);
      String _plus_6 = (_plus_5 + "pt");
      String _plus_7 = (_plus_6 + "\n");
      command = _plus_7;
      String _plus_8 = (command + "FILL color:");
      command = _plus_8;
      FillColor _fillcolor = ss.getFillcolor();
      String _hexcolor_2 = _fillcolor.getHexcolor();
      boolean _notEquals_1 = (!Objects.equal(_hexcolor_2, null));
      if (_notEquals_1) {
        FillColor _fillcolor_1 = ss.getFillcolor();
        String _hexcolor_3 = _fillcolor_1.getHexcolor();
        String _graphRepColor_1 = this.toGraphRepColor(_hexcolor_3);
        String _plus_9 = (command + _graphRepColor_1);
        command = _plus_9;
      } else {
        FillColor _fillcolor_2 = ss.getFillcolor();
        Color _color_1 = _fillcolor_2.getColor();
        String _plus_10 = (command + _color_1);
        String _plus_11 = (_plus_10 + "\n");
        command = _plus_11;
      }
      return command;
    }
    
    public String generateCSymbol(final org.xtext.nv.dsl.mMDSL.Class c) {
      String command = "";
      SymbolClass _symbolclass = c.getSymbolclass();
      EList<SVGCommand> _svgcommand = _symbolclass.getSvgcommand();
      for (final SVGCommand svgc : _svgcommand) {
        {
          SymbolStyle _symbolstyle = svgc.getSymbolstyle();
          boolean _notEquals = (!Objects.equal(_symbolstyle, null));
          if (_notEquals) {
            SymbolStyle _symbolstyle_1 = svgc.getSymbolstyle();
            String _applyStyle = this.applyStyle(_symbolstyle_1);
            String _plus = (command + _applyStyle);
            command = _plus;
          } else {
            SymbolStyle _symbolstyleref = svgc.getSymbolstyleref();
            boolean _notEquals_1 = (!Objects.equal(_symbolstyleref, null));
            if (_notEquals_1) {
              SymbolStyle _symbolstyleref_1 = svgc.getSymbolstyleref();
              String _applyStyle_1 = this.applyStyle(_symbolstyleref_1);
              String _plus_1 = (command + _applyStyle_1);
              command = _plus_1;
            } else {
              SymbolClass _symbolclass_1 = c.getSymbolclass();
              SymbolStyle _globalstyle = _symbolclass_1.getGlobalstyle();
              boolean _notEquals_2 = (!Objects.equal(_globalstyle, null));
              if (_notEquals_2) {
                SymbolClass _symbolclass_2 = c.getSymbolclass();
                SymbolStyle _globalstyle_1 = _symbolclass_2.getGlobalstyle();
                String _applyStyle_2 = this.applyStyle(_globalstyle_1);
                String _plus_2 = (command + _applyStyle_2);
                command = _plus_2;
              } else {
                String _defaultStyle = this.defaultStyle();
                String _plus_3 = (command + _defaultStyle);
                command = _plus_3;
              }
            }
          }
          String _graphRepCommand = this.toGraphRepCommand(svgc);
          String _plus_4 = (command + _graphRepCommand);
          command = _plus_4;
        }
      }
      return command;
    }
    
    public String generateRSymobl(final Relation r) {
      String command = "START\n";
      SymbolRelation _symbolrelation = r.getSymbolrelation();
      EList<SVGCommand> _svgcommandsfrom = _symbolrelation.getSvgcommandsfrom();
      for (final SVGCommand svgcfrom : _svgcommandsfrom) {
        {
          SymbolStyle _symbolstyle = svgcfrom.getSymbolstyle();
          boolean _notEquals = (!Objects.equal(_symbolstyle, null));
          if (_notEquals) {
            SymbolStyle _symbolstyle_1 = svgcfrom.getSymbolstyle();
            String _applyStyle = this.applyStyle(_symbolstyle_1);
            String _plus = (command + _applyStyle);
            command = _plus;
          } else {
            SymbolStyle _symbolstyleref = svgcfrom.getSymbolstyleref();
            boolean _notEquals_1 = (!Objects.equal(_symbolstyleref, null));
            if (_notEquals_1) {
              SymbolStyle _symbolstyleref_1 = svgcfrom.getSymbolstyleref();
              String _applyStyle_1 = this.applyStyle(_symbolstyleref_1);
              String _plus_1 = (command + _applyStyle_1);
              command = _plus_1;
            } else {
              SymbolRelation _symbolrelation_1 = r.getSymbolrelation();
              SymbolStyle _globalstyle = _symbolrelation_1.getGlobalstyle();
              boolean _notEquals_2 = (!Objects.equal(_globalstyle, null));
              if (_notEquals_2) {
                SymbolRelation _symbolrelation_2 = r.getSymbolrelation();
                SymbolStyle _globalstyle_1 = _symbolrelation_2.getGlobalstyle();
                String _applyStyle_2 = this.applyStyle(_globalstyle_1);
                String _plus_2 = (command + _applyStyle_2);
                command = _plus_2;
              } else {
                String _defaultStyle = this.defaultStyle();
                String _plus_3 = (command + _defaultStyle);
                command = _plus_3;
              }
            }
          }
          String _graphRepCommand = this.toGraphRepCommand(svgcfrom);
          String _plus_4 = (command + _graphRepCommand);
          command = _plus_4;
        }
      }
      String _plus = (command + "MIDDLE\n");
      command = _plus;
      SymbolRelation _symbolrelation_1 = r.getSymbolrelation();
      EList<SVGCommand> _svgcommandsmiddle = _symbolrelation_1.getSvgcommandsmiddle();
      for (final SVGCommand svgcline : _svgcommandsmiddle) {
        {
          SymbolStyle _symbolstyle = svgcline.getSymbolstyle();
          boolean _notEquals = (!Objects.equal(_symbolstyle, null));
          if (_notEquals) {
            SymbolStyle _symbolstyle_1 = svgcline.getSymbolstyle();
            String _applyStyle = this.applyStyle(_symbolstyle_1);
            String _plus_1 = (command + _applyStyle);
            command = _plus_1;
          } else {
            SymbolStyle _symbolstyleref = svgcline.getSymbolstyleref();
            boolean _notEquals_1 = (!Objects.equal(_symbolstyleref, null));
            if (_notEquals_1) {
              SymbolStyle _symbolstyleref_1 = svgcline.getSymbolstyleref();
              String _applyStyle_1 = this.applyStyle(_symbolstyleref_1);
              String _plus_2 = (command + _applyStyle_1);
              command = _plus_2;
            } else {
              SymbolRelation _symbolrelation_2 = r.getSymbolrelation();
              SymbolStyle _globalstyle = _symbolrelation_2.getGlobalstyle();
              boolean _notEquals_2 = (!Objects.equal(_globalstyle, null));
              if (_notEquals_2) {
                SymbolRelation _symbolrelation_3 = r.getSymbolrelation();
                SymbolStyle _globalstyle_1 = _symbolrelation_3.getGlobalstyle();
                String _applyStyle_2 = this.applyStyle(_globalstyle_1);
                String _plus_3 = (command + _applyStyle_2);
                command = _plus_3;
              } else {
                String _defaultStyle = this.defaultStyle();
                String _plus_4 = (command + _defaultStyle);
                command = _plus_4;
              }
            }
          }
          String _graphRepCommand = this.toGraphRepCommand(svgcline);
          String _plus_5 = (command + _graphRepCommand);
          command = _plus_5;
        }
      }
      String _plus_1 = (command + "END\n");
      command = _plus_1;
      SymbolRelation _symbolrelation_2 = r.getSymbolrelation();
      EList<SVGCommand> _svgcommandsto = _symbolrelation_2.getSvgcommandsto();
      for (final SVGCommand svgcto : _svgcommandsto) {
        {
          SymbolStyle _symbolstyle = svgcto.getSymbolstyle();
          boolean _notEquals = (!Objects.equal(_symbolstyle, null));
          if (_notEquals) {
            SymbolStyle _symbolstyle_1 = svgcto.getSymbolstyle();
            String _applyStyle = this.applyStyle(_symbolstyle_1);
            String _plus_2 = (command + _applyStyle);
            command = _plus_2;
          } else {
            SymbolStyle _symbolstyleref = svgcto.getSymbolstyleref();
            boolean _notEquals_1 = (!Objects.equal(_symbolstyleref, null));
            if (_notEquals_1) {
              SymbolStyle _symbolstyleref_1 = svgcto.getSymbolstyleref();
              String _applyStyle_1 = this.applyStyle(_symbolstyleref_1);
              String _plus_3 = (command + _applyStyle_1);
              command = _plus_3;
            } else {
              SymbolRelation _symbolrelation_3 = r.getSymbolrelation();
              SymbolStyle _globalstyle = _symbolrelation_3.getGlobalstyle();
              boolean _notEquals_2 = (!Objects.equal(_globalstyle, null));
              if (_notEquals_2) {
                SymbolRelation _symbolrelation_4 = r.getSymbolrelation();
                SymbolStyle _globalstyle_1 = _symbolrelation_4.getGlobalstyle();
                String _applyStyle_2 = this.applyStyle(_globalstyle_1);
                String _plus_4 = (command + _applyStyle_2);
                command = _plus_4;
              } else {
                String _defaultStyle = this.defaultStyle();
                String _plus_5 = (command + _defaultStyle);
                command = _plus_5;
              }
            }
          }
          String _graphRepCommand = this.toGraphRepCommand(svgcto);
          String _plus_6 = (command + _graphRepCommand);
          command = _plus_6;
        }
      }
      return command;
    }
    
    public String toGraphRepColor(final String hex) {
      String _substring = hex.substring(1, 7);
      return ("$" + _substring);
    }
    
    public String toGraphRepCommand(final SVGCommand svg) {
      String command = "";
      boolean _equals = Objects.equal(svg, null);
      if (_equals) {
        return command;
      }
      Rectangle _rectangle = svg.getRectangle();
      boolean _notEquals = (!Objects.equal(_rectangle, null));
      if (_notEquals) {
        final Rectangle r = svg.getRectangle();
        String _plus = ("RECTANGLE" + 
          " x:");
        String _x = r.getX();
        String _plus_1 = (_plus + _x);
        String _plus_2 = (_plus_1 + "pt");
        String _plus_3 = (_plus_2 + 
          " y:");
        String _y = r.getY();
        String _plus_4 = (_plus_3 + _y);
        String _plus_5 = (_plus_4 + "pt");
        String _plus_6 = (_plus_5 + 
          " h:");
        String _width = r.getWidth();
        String _plus_7 = (_plus_6 + _width);
        String _plus_8 = (_plus_7 + "pt");
        String _plus_9 = (_plus_8 + 
          " w:");
        String _height = r.getHeight();
        String _plus_10 = (_plus_9 + _height);
        String _plus_11 = (_plus_10 + "pt");
        command = _plus_11;
      } else {
        Circle _circle = svg.getCircle();
        boolean _notEquals_1 = (!Objects.equal(_circle, null));
        if (_notEquals_1) {
          final Circle c = svg.getCircle();
          String _plus_12 = ("ELLIPSE" + 
            " x:");
          String _cx = c.getCx();
          String _plus_13 = (_plus_12 + _cx);
          String _plus_14 = (_plus_13 + "pt");
          String _plus_15 = (_plus_14 + 
            " y:");
          String _cy = c.getCy();
          String _plus_16 = (_plus_15 + _cy);
          String _plus_17 = (_plus_16 + "pt");
          String _plus_18 = (_plus_17 + 
            " rx:");
          String _r = c.getR();
          String _plus_19 = (_plus_18 + _r);
          String _plus_20 = (_plus_19 + "pt");
          String _plus_21 = (_plus_20 + 
            " ry:");
          String _r_1 = c.getR();
          String _plus_22 = (_plus_21 + _r_1);
          String _plus_23 = (_plus_22 + "pt");
          command = _plus_23;
        } else {
          Ellipse _ellipse = svg.getEllipse();
          boolean _notEquals_2 = (!Objects.equal(_ellipse, null));
          if (_notEquals_2) {
            final Ellipse e = svg.getEllipse();
            String _plus_24 = ("ELLIPSE" + 
              " x:");
            String _cx_1 = e.getCx();
            String _plus_25 = (_plus_24 + _cx_1);
  