Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EcoreFactory


            Configuration.getXMIOutput()));
    m_oOptions = new HashMap<String, Boolean>();
    m_oOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);

   
    EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
    EcorePackage ecorePackage = EcorePackage.eINSTANCE;

    // create TCGNode
    EClass oNodeClass = ecoreFactory.createEClass();
    oNodeClass.setName("TCGNode");
   
    // attribute name of TCGNode
    EAttribute oNodeName = ecoreFactory.createEAttribute();
    oNodeName.setName("name");
    oNodeName.setEType(ecorePackage.getEString());
    oNodeClass.getEStructuralFeatures().add(oNodeName);
   
    // create TCGArc
    EClass oArcClass = ecoreFactory.createEClass();
    oArcClass.setName("TCGArc");
   
    // attribute name of TCGArc
    EAttribute oArcName = ecoreFactory.createEAttribute();
    oArcName.setName("name");
    oArcName.setEType(ecorePackage.getEString());
    oArcClass.getEStructuralFeatures().add(oArcName);
   
    // reference source of TCGArc
    EReference oArcSource = ecoreFactory.createEReference();
    oArcSource.setName("source");
    oArcSource.setEType(oNodeClass);
    oArcSource.setLowerBound(1);
    oArcSource.setUpperBound(1);
   
    // reference target of TCGArc
    EReference oArcTarget = ecoreFactory.createEReference();
    oArcTarget.setName("target");
    oArcTarget.setEType(oNodeClass);
    oArcTarget.setLowerBound(1);
    oArcTarget.setUpperBound(1);
   
    // create TestCaseGraph
    EClass oTCGClass = ecoreFactory.createEClass();
    oTCGClass.setName("TestCaseGraph");
   
    // a test case graph refrences the root node
    EReference oRootReference = ecoreFactory.createEReference();
    oRootReference.setName("root");
    oRootReference.setEType(oNodeClass);
    oRootReference.setLowerBound(1);
    oRootReference.setUpperBound(1);

    // erstes Package, das node, arc und tcg enth�lt
    EPackage graphPackage = ecoreFactory.createEPackage();
    graphPackage.setName("graph");
    graphPackage.setNsPrefix("graph");
    graphPackage.setNsURI("http:///com.example.graph.ecore");
    graphPackage.getEClassifiers().add(oNodeClass);
    graphPackage.getEClassifiers().add(oArcClass);
View Full Code Here


            Configuration.getXMIOutput()));
    m_oOptions = new HashMap<String, Boolean>();
    m_oOptions.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);

   
    EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
    EcorePackage ecorePackage = EcorePackage.eINSTANCE;

    // create TCGNode
    EClass oNodeClass = ecoreFactory.createEClass();
    oNodeClass.setName("TCGNode");
   
    // attribute name of TCGNode
    EAttribute oNodeName = ecoreFactory.createEAttribute();
    oNodeName.setName("name");
    oNodeName.setEType(ecorePackage.getEString());
    oNodeClass.getEStructuralFeatures().add(oNodeName);
   
    // create TCGArc
    EClass oArcClass = ecoreFactory.createEClass();
    oArcClass.setName("TCGArc");
   
    // attribute name of TCGArc
    EAttribute oArcName = ecoreFactory.createEAttribute();
    oArcName.setName("name");
    oArcName.setEType(ecorePackage.getEString());
    oArcClass.getEStructuralFeatures().add(oArcName);
   
    // reference source of TCGArc
    EReference oArcSource = ecoreFactory.createEReference();
    oArcSource.setName("source");
    oArcSource.setEType(oNodeClass);
    oArcSource.setLowerBound(1);
    oArcSource.setUpperBound(1);
   
    // reference target of TCGArc
    EReference oArcTarget = ecoreFactory.createEReference();
    oArcTarget.setName("target");
    oArcTarget.setEType(oNodeClass);
    oArcTarget.setLowerBound(1);
    oArcTarget.setUpperBound(1);
   
    // create TestCaseGraph
    EClass oTCGClass = ecoreFactory.createEClass();
    oTCGClass.setName("TestCaseGraph");
   
    // a test case graph refrences the root node
    EReference oRootReference = ecoreFactory.createEReference();
    oRootReference.setName("root");
    oRootReference.setEType(oNodeClass);
    oRootReference.setLowerBound(1);
    oRootReference.setUpperBound(1);

    // erstes Package, das node, arc und tcg enth�lt
    EPackage graphPackage = ecoreFactory.createEPackage();
    graphPackage.setName("graph");
    graphPackage.setNsPrefix("graph");
    graphPackage.setNsURI("http:///com.example.graph.ecore");
    graphPackage.getEClassifiers().add(oNodeClass);
    graphPackage.getEClassifiers().add(oArcClass);
View Full Code Here

    {}*/
  }

  public void createMetamodel()
  {
    EcoreFactory ecoreFactory = EcoreFactory.eINSTANCE;
    EcorePackage ecorePackage = EcorePackage.eINSTANCE;

    // create TCGNode
    EClass oNodeClass = ecoreFactory.createEClass();
    oNodeClass.setName("TCGNode");
   
    // attribute name of TCGNode
    EAttribute oNodeName = ecoreFactory.createEAttribute();
    oNodeName.setName("name");
    oNodeName.setEType(ecorePackage.getEString());
    oNodeClass.getEStructuralFeatures().add(oNodeName);
   
    // reference incoming arc of node
    //EReference o
   
    // create TCGArc
    EClass oArcClass = ecoreFactory.createEClass();
    oArcClass.setName("TCGArc");
   
    // attribute name of TCGArc
    EAttribute oArcName = ecoreFactory.createEAttribute();
    oArcName.setName("name");
    oArcName.setEType(ecorePackage.getEString());
    oArcClass.getEStructuralFeatures().add(oArcName);
   
    // reference source of TCGArc
    EReference oArcSource = ecoreFactory.createEReference();
    oArcSource.setName("source");
    oArcSource.setEType(oNodeClass);
    oArcSource.setLowerBound(1);
    oArcSource.setUpperBound(1);
   
    // reference target of TCGArc
    EReference oArcTarget = ecoreFactory.createEReference();
    oArcTarget.setName("target");
    oArcTarget.setEType(oNodeClass);
    oArcTarget.setLowerBound(1);
    oArcTarget.setUpperBound(1);
   
    // create TestCaseGraph
    EClass oTCGClass = ecoreFactory.createEClass();
    oTCGClass.setName("TestCaseGraph");
   
    // a test case graph refrences the root node
    EReference oRootReference = ecoreFactory.createEReference();
    oRootReference.setName("root");
    oRootReference.setEType(oNodeClass);
    oRootReference.setLowerBound(1);
    oRootReference.setUpperBound(1);

 
    m_oResourceEcoreOut.getContents().add(oNodeClass);
    m_oResourceEcoreOut.getContents().add(oArcClass);
    m_oResourceEcoreOut.getContents().add(oTCGClass);
    try {
      m_oResourceEcoreOut.save(m_oOptions);
    }
    catch(IOException e)
    {}

   
   
    EPackage companyPackage = ecoreFactory.createEPackage();
    companyPackage.setName("company");
    companyPackage.setNsPrefix("company");
    companyPackage.setNsURI("http:///com.example.company.ecore");
    companyPackage.getEClassifiers().add(oNodeClass);
    companyPackage.getEClassifiers().add(oArcClass);
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.EcoreFactory

Copyright © 2018 www.massapicom. 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.