Aadl2SyntacticSequencer.java

/**
 * Copyright (c) 2004-2025 Carnegie Mellon University and others. (see Contributors file).
 * All Rights Reserved.
 * 
 * NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
 * OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
 * MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
 * 
 * This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 * SPDX-License-Identifier: EPL-2.0
 * 
 * Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
 * 
 * This program includes and/or can make use of certain third party source code, object code, documentation and other
 * files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
 * configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
 * conditions contained in any such Third Party Software or separate license file distributed with such Third Party
 * Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici-
 * aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li-
 * censes only apply to the Third Party Software and not any other portion of this program or this program as a whole.
 */
package org.osate.xtext.aadl2.serializer;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;
import org.osate.aadl2.AadlPackage;
import org.osate.aadl2.Classifier;
import org.osate.aadl2.ComponentImplementation;
import org.osate.aadl2.PropertySet;

@SuppressWarnings("all")
public class Aadl2SyntacticSequencer extends AbstractAadl2SyntacticSequencer {
  /**
   * Adds the ending identifier to classifiers, packages, and property sets when serializing.
   */
  @Override
  protected String getIDToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((semanticObject instanceof Classifier)) {
      _xifexpression = ((Classifier)semanticObject).getName();
    } else {
      String _xifexpression_1 = null;
      if ((semanticObject instanceof AadlPackage)) {
        _xifexpression_1 = ((AadlPackage)semanticObject).getName();
      } else {
        String _xifexpression_2 = null;
        if ((semanticObject instanceof PropertySet)) {
          _xifexpression_2 = ((PropertySet)semanticObject).getName();
        } else {
          _xifexpression_2 = super.getIDToken(semanticObject, ruleCall, node);
        }
        _xifexpression_1 = _xifexpression_2;
      }
      _xifexpression = _xifexpression_1;
    }
    return _xifexpression;
  }

  @Override
  protected String getFULLINAMEToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((semanticObject instanceof ComponentImplementation)) {
      _xifexpression = ((ComponentImplementation)semanticObject).getName();
    } else {
      _xifexpression = super.getFULLINAMEToken(semanticObject, ruleCall, node);
    }
    return _xifexpression;
  }

  @Override
  protected String getPNAMEToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((semanticObject instanceof AadlPackage)) {
      _xifexpression = ((AadlPackage)semanticObject).getName();
    } else {
      _xifexpression = super.getPNAMEToken(semanticObject, ruleCall, node);
    }
    return _xifexpression;
  }

  /**
   * AbstractImplementationKeywords:
   * 	'abstract' 'implementation'
   * ;
   */
  @Override
  protected String getAbstractImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "abstract implementation";
    }
    return _xifexpression;
  }

  /**
   * AppliesToKeywords:
   * 	'applies' 'to'
   * ;
   */
  @Override
  protected String getAppliesToKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "applies to";
    }
    return _xifexpression;
  }

  /**
   * BusAccessKeywords:
   * 	'bus' 'access'
   * ;
   */
  @Override
  protected String getBusAccessKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "bus access";
    }
    return _xifexpression;
  }

  /**
   * BusImplementationKeywords:
   * 	'bus' 'implementation'
   * ;
   */
  @Override
  protected String getBusImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "bus implementation";
    }
    return _xifexpression;
  }

  /**
   * DataAccessKeywords:
   * 	'data' 'access'
   * ;
   */
  @Override
  protected String getDataAccessKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "data access";
    }
    return _xifexpression;
  }

  /**
   * DataImplementationKeywords:
   * 	'data' 'implementation'
   * ;
   */
  @Override
  protected String getDataImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "data implementation";
    }
    return _xifexpression;
  }

  /**
   * DataPortKeywords:
   * 	'data' 'port'
   * ;
   */
  @Override
  protected String getDataPortKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "data port";
    }
    return _xifexpression;
  }

  /**
   * DeviceImplementationKeywords:
   * 	'device' 'implementation'
   * ;
   */
  @Override
  protected String getDeviceImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "device implementation";
    }
    return _xifexpression;
  }

  /**
   * EndToEndFlowKeywords:
   * 	'end' 'to' 'end' 'flow'
   * ;
   */
  @Override
  protected String getEndToEndFlowKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "end to end flow";
    }
    return _xifexpression;
  }

  /**
   * EventDataKeywords:
   * 	'event' 'data'
   * ;
   */
  @Override
  protected String getEventDataKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "event data";
    }
    return _xifexpression;
  }

  /**
   * EventDataPortKeywords:
   * 	'event' 'data' 'port'
   * ;
   */
  @Override
  protected String getEventDataPortKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "event data port";
    }
    return _xifexpression;
  }

  /**
   * EventPortKeywords:
   * 	'event' 'port'
   * ;
   */
  @Override
  protected String getEventPortKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "event port";
    }
    return _xifexpression;
  }

  /**
   * FeatureGroupKeywords:
   * 	'feature' 'group'
   * ;
   */
  @Override
  protected String getFeatureGroupKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "feature group";
    }
    return _xifexpression;
  }

  /**
   * InBindingKeywords:
   * 	'in' 'binding'
   * ;
   */
  @Override
  protected String getInBindingKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "in binding";
    }
    return _xifexpression;
  }

  /**
   * InModesKeywords:
   * 	'in' 'modes'
   * ;
   */
  @Override
  protected String getInModesKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "in modes";
    }
    return _xifexpression;
  }

  /**
   * InternalFeaturesKeywords:
   * 	'internal' 'features'
   * ;
   */
  @Override
  protected String getInternalFeaturesKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "internal features";
    }
    return _xifexpression;
  }

  /**
   * InverseOfKeywords:
   * 	'inverse' 'of'
   * ;
   */
  @Override
  protected String getInverseOfKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "inverse of";
    }
    return _xifexpression;
  }

  /**
   * ListOfKeywords:
   * 	'list' 'of'
   * ;
   */
  @Override
  protected String getListOfKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "list of";
    }
    return _xifexpression;
  }

  /**
   * MemoryImplementationKeywords:
   * 	'memory' 'implementation'
   * ;
   */
  @Override
  protected String getMemoryImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "memory implementation";
    }
    return _xifexpression;
  }

  /**
   * ProcessImplementationKeywords:
   * 	'process' 'implementation'
   * ;
   */
  @Override
  protected String getProcessImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "process implementation";
    }
    return _xifexpression;
  }

  /**
   * ProcessorFeaturesKeywords:
   * 	'processor' 'features'
   * ;
   */
  @Override
  protected String getProcessorFeaturesKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "processor features";
    }
    return _xifexpression;
  }

  /**
   * ProcessorImplementationKeywords:
   * 	'processor' 'implementation'
   * ;
   */
  @Override
  protected String getProcessorImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "processor implementation";
    }
    return _xifexpression;
  }

  /**
   * RangeOfKeywords:
   * 	'range' 'of'
   * ;
   */
  @Override
  protected String getRangeOfKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "range of";
    }
    return _xifexpression;
  }

  /**
   * RefinedToKeywords:
   * 	'refined' 'to'
   * ;
   */
  @Override
  protected String getRefinedToKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "refined to";
    }
    return _xifexpression;
  }

  /**
   * RequiresModesKeywords:
   * 	'requires' 'modes'
   * ;
   */
  @Override
  protected String getRequiresModesKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "requires modes";
    }
    return _xifexpression;
  }

  /**
   * SubprogramAccessKeywords:
   * 	'subprogram' 'access'
   * ;
   */
  @Override
  protected String getSubprogramAccessKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "subprogram access";
    }
    return _xifexpression;
  }

  /**
   * SubprogramGroupAccessKeywords:
   * 	'subprogram' 'group' 'access'
   * ;
   */
  @Override
  protected String getSubprogramGroupAccessKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "subprogram group access";
    }
    return _xifexpression;
  }

  /**
   * SubprogramGroupImplementationKeywords:
   * 	'subprogram' 'group' 'implementation'
   * ;
   */
  @Override
  protected String getSubprogramGroupImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "subprogram group implementation";
    }
    return _xifexpression;
  }

  /**
   * SubprogramGroupKeywords:
   * 	'subprogram' 'group'
   * ;
   */
  @Override
  protected String getSubprogramGroupKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "subprogram group";
    }
    return _xifexpression;
  }

  /**
   * SubprogramImplementationKeywords:
   * 	'subprogram' 'implementation'
   * ;
   */
  @Override
  protected String getSubprogramImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "subprogram implementation";
    }
    return _xifexpression;
  }

  /**
   * SystemImplementationKeywords:
   * 	'system' 'implementation'
   * ;
   */
  @Override
  protected String getSystemImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "system implementation";
    }
    return _xifexpression;
  }

  /**
   * ThreadGroupImplementationKeywords:
   * 	'thread' 'group' 'implementation'
   * ;
   */
  @Override
  protected String getThreadGroupImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "thread group implementation";
    }
    return _xifexpression;
  }

  /**
   * ThreadGroupKeywords:
   * 	'thread' 'group'
   * ;
   */
  @Override
  protected String getThreadGroupKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "thread group";
    }
    return _xifexpression;
  }

  /**
   * ThreadImplementationKeywords:
   * 	'thread' 'implementation'
   * ;
   */
  @Override
  protected String getThreadImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "thread implementation";
    }
    return _xifexpression;
  }

  /**
   * VirtualBusImplementationKeywords:
   * 	'virtual' 'bus' 'implementation'
   * ;
   */
  @Override
  protected String getVirtualBusImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "virtual bus implementation";
    }
    return _xifexpression;
  }

  /**
   * VirtualBusKeywords:
   * 	'virtual' 'bus'
   * ;
   */
  @Override
  protected String getVirtualBusKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "virtual bus";
    }
    return _xifexpression;
  }

  /**
   * VirtualProcessorImplementationKeywords:
   * 	'virtual' 'processor' 'implementation'
   * ;
   */
  @Override
  protected String getVirtualProcessorImplementationKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "virtual processor implementation";
    }
    return _xifexpression;
  }

  /**
   * VirtualProcessorKeywords:
   * 	'virtual' 'processor'
   * ;
   */
  @Override
  protected String getVirtualProcessorKeywordsToken(final EObject semanticObject, final RuleCall ruleCall, final INode node) {
    String _xifexpression = null;
    if ((node != null)) {
      _xifexpression = this.getTokenText(node);
    } else {
      _xifexpression = "virtual processor";
    }
    return _xifexpression;
  }
}