Package no.hal.jex.impl

Source Code of no.hal.jex.impl.ExercisePartImpl

/**
* <copyright>
* </copyright>
*
* $Id$
*/
package no.hal.jex.impl;


import no.hal.jex.AbstractRequirement;
import no.hal.jex.ExercisePart;
import no.hal.jex.JexPackage;

import org.eclipse.emf.ecore.EClass;

/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Exercise Part</b></em>'.
* <!-- end-user-doc -->
* <p>
* </p>
*
* @generated
*/
public class ExercisePartImpl extends AbstractRequirementImpl implements ExercisePart {
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ExercisePartImpl() {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass() {
    return JexPackage.Literals.EXERCISE_PART;
  }

  public static String getPartNumber(ExercisePart part) {
    AbstractRequirement parent = part.getParent();
    String partNumber = Integer.toString(parent.getRequirements().indexOf(part) + 1);
    if (parent instanceof ExercisePart) {
      partNumber = getPartNumber((ExercisePart)parent) + "." + partNumber;
    }
    return partNumber;
  }

  protected String getDefaultURIFragment() {
    return "#part" + getPartNumber(this);
  }
 
} //ExercisePartImpl
TOP

Related Classes of no.hal.jex.impl.ExercisePartImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.