Author: timotei
Date: Thu Aug  4 21:15:58 2011
New Revision: 50605

URL: http://svn.gna.org/viewcvs/wesnoth?rev=50605&view=rev
Log:
eclipse plugin: Implement a convenience method that
returns the cardinality of a WMLExpression as Integer

Modified:
    trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.ecore
    trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.genmodel
    trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/WMLExpression.java
    
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLExpressionImpl.java
    
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLMacroCallImpl.java
    
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WmlPackageImpl.java
    trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/WMLPostProcessor.ext

Modified: trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.ecore
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.ecore?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.ecore (original)
+++ trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.ecore Thu Aug  4 
21:15:58 2011
@@ -110,6 +110,11 @@
         <details key="body" value="return _Cardinality == '*';"/>
       </eAnnotations>
     </eOperations>
+    <eOperations name="getAllowedCount" eType="ecore:EDataType 
http://www.eclipse.org/emf/2002/Ecore#//EInt";>
+      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel";>
+        <details key="body" value="switch( _Cardinality ) {&#xA;               
 case '-': return 0;&#xA;                case '?': case '1':  return 1;&#xA;    
        }&#xA;            // by default let it be infinite times&#xA;           
 return Integer.MAX_VALUE;"/>
+      </eAnnotations>
+    </eOperations>
     <eOperations name="isWMLTag" eType="ecore:EDataType 
http://www.eclipse.org/emf/2002/Ecore#//EBoolean";>
       <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel";>
         <details key="body" value="return ( this instanceof WMLTag );"/>

Modified: trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.genmodel
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.genmodel?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.genmodel (original)
+++ trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/WML.genmodel Thu Aug  4 
21:15:58 2011
@@ -57,6 +57,7 @@
       <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/is_Forbidden"/>
       <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/is_Optional"/>
       <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/is_Repeatable"/>
+      <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/getAllowedCount"/>
       <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/isWMLTag"/>
       <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/asWMLTag"/>
       <genOperations 
ecoreOperation="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression/isWMLKey"/>

Modified: 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/WMLExpression.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/WMLExpression.java?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/WMLExpression.java 
(original)
+++ trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/WMLExpression.java 
Thu Aug  4 21:15:58 2011
@@ -116,6 +116,15 @@
    * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
    * @model kind="operation"
+   *        annotation="http://www.eclipse.org/emf/2002/GenModel body='switch( 
_Cardinality ) {\n                case \'-\': return 0;\n                case 
\'?\': case \'1\':  return 1;\n            }\n            // by default let it 
be infinite times\n            return Integer.MAX_VALUE;'"
+   * @generated
+   */
+  int getAllowedCount();
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @model kind="operation"
    *        annotation="http://www.eclipse.org/emf/2002/GenModel body='return 
( this instanceof WMLTag );'"
    * @generated
    */

Modified: 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLExpressionImpl.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLExpressionImpl.java?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLExpressionImpl.java
 (original)
+++ 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLExpressionImpl.java
 Thu Aug  4 21:15:58 2011
@@ -192,6 +192,21 @@
    * <!-- end-user-doc -->
    * @generated
    */
+  public int getAllowedCount()
+  {
+    switch( _Cardinality ) {
+                    case '-': return 0;
+                    case '?': case '1':  return 1;
+                }
+                // by default let it be infinite times
+                return Integer.MAX_VALUE;
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
   public boolean isWMLTag()
   {
     return ( this instanceof WMLTag );

Modified: 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLMacroCallImpl.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLMacroCallImpl.java?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLMacroCallImpl.java
 (original)
+++ 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WMLMacroCallImpl.java
 Thu Aug  4 21:15:58 2011
@@ -318,6 +318,21 @@
    * <!-- end-user-doc -->
    * @generated
    */
+  public int getAllowedCount()
+  {
+    switch( _Cardinality ) {
+                    case '-': return 0;
+                    case '?': case '1':  return 1;
+                }
+                // by default let it be infinite times
+                return Integer.MAX_VALUE;
+  }
+
+  /**
+   * <!-- begin-user-doc -->
+   * <!-- end-user-doc -->
+   * @generated
+   */
   public boolean isWMLTag()
   {
     return ( this instanceof WMLTag );

Modified: 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WmlPackageImpl.java
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WmlPackageImpl.java?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WmlPackageImpl.java
 (original)
+++ 
trunk/utils/umc_dev/org.wesnoth/src-gen/org/wesnoth/wml/impl/WmlPackageImpl.java
 Thu Aug  4 21:15:58 2011
@@ -908,6 +908,8 @@
 
     addEOperation(wmlExpressionEClass, ecorePackage.getEBoolean(), 
"is_Repeatable", 0, 1, IS_UNIQUE, IS_ORDERED);
 
+    addEOperation(wmlExpressionEClass, ecorePackage.getEInt(), 
"getAllowedCount", 0, 1, IS_UNIQUE, IS_ORDERED);
+
     addEOperation(wmlExpressionEClass, ecorePackage.getEBoolean(), "isWMLTag", 
0, 1, IS_UNIQUE, IS_ORDERED);
 
     addEOperation(wmlExpressionEClass, this.getWMLTag(), "asWMLTag", 0, 1, 
IS_UNIQUE, IS_ORDERED);

Modified: trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/WMLPostProcessor.ext
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/WMLPostProcessor.ext?rev=50605&r1=50604&r2=50605&view=diff
==============================================================================
--- trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/WMLPostProcessor.ext 
(original)
+++ trunk/utils/umc_dev/org.wesnoth/src/org/wesnoth/WMLPostProcessor.ext Thu 
Aug  4 21:15:58 2011
@@ -21,6 +21,14 @@
         createCardinalityOperation( "is_Forbidden", '-' ) ->
         createCardinalityOperation( "is_Optional", '?' ) ->
         createCardinalityOperation( "is_Repeatable", '*' ) ->
+        
+        createOperation( "getAllowedCount",
+            "switch( _Cardinality ) {
+                case '-': return 0;
+                case '?': case '1':  return 1;
+            }
+            // by default let it be infinite times
+            return Integer.MAX_VALUE;", eint() ) ->
         
         createOperation( "isWMLTag", 
             "return ( this instanceof WMLTag );", eboolean() ) ->
@@ -124,6 +132,7 @@
 EDataType estring(): ecoreType( "EString" );
 EDataType echar(): ecoreType( "EChar" );
 EDataType eboolean(): ecoreType( "EBoolean" );
+EDataType eint(): ecoreType( "EInt" );
 
 EClass wmlClass( String name ):
     wmlPackage().getEClassifier( name );


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to