You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by el...@apache.org on 2006/12/08 09:30:41 UTC

svn commit: r483880 - /labs/dungeon/src/main/java/org/apache/dungeon/meta/parser/MetaProduction.java

Author: elecharny
Date: Fri Dec  8 00:30:40 2006
New Revision: 483880

URL: http://svn.apache.org/viewvc?view=rev&rev=483880
Log:
Added some javadoc. Removed the 'name' field

Modified:
    labs/dungeon/src/main/java/org/apache/dungeon/meta/parser/MetaProduction.java

Modified: labs/dungeon/src/main/java/org/apache/dungeon/meta/parser/MetaProduction.java
URL: http://svn.apache.org/viewvc/labs/dungeon/src/main/java/org/apache/dungeon/meta/parser/MetaProduction.java?view=diff&rev=483880&r1=483879&r2=483880
==============================================================================
--- labs/dungeon/src/main/java/org/apache/dungeon/meta/parser/MetaProduction.java (original)
+++ labs/dungeon/src/main/java/org/apache/dungeon/meta/parser/MetaProduction.java Fri Dec  8 00:30:40 2006
@@ -20,66 +20,99 @@
 package org.apache.dungeon.meta.parser;
 
 /**
+ * A production contains a LHS and a list of rules. 
  * 
- * TODO MetaProduction.
+ * production :
+ *  A -> aAbB [ | cCdD [ | ... [ | # ] ] ]...]
+ *  
+ *  where A, B, C and D are non terminal symbols,
+ *  a, b, c and d are terminal symbols
+ *  and # is an optional epsilon transition.
+ *  
+ *  A production can have one to N rules
+ *  
  *
  * @author <a href="mailto:dev@labs.apache.org">Dungeon Project</a>
  * @version $Rev$, $Date$
  */
 public class MetaProduction extends AbstractProduction 
 {
-	private String name;
+    /** The RHS list */
 	private MetaRhs rhs;
+    
+    /** This flag is set if the production has an epsilon transition */ 
     private boolean epsilonTransition;
+    
+    /** The production's LHS */ 
     private Symbol lhs;
 	
+    /**
+     * Create a new Production
+     *
+     */
 	public MetaProduction()
 	{
 		rhs = null;
         epsilonTransition = false;
 	}
 
+    /**
+     * @return The production's LHS name
+     */
 	public String getName() 
 	{
-		return name;
+		return lhs.getName();
 	}
 
-	public void setName(String name) 
-	{
-		this.name = name;
-	}
-    
+    /**
+     * Add a new RHS to the current production
+     * @param rhs The RHS associated with this production
+     */
     public void setRhs( MetaRhs rhs )
     {
         this.rhs = rhs;
     }
     
+    /**
+     * 
+     * @return The production's RHS
+     */
     public MetaRhs getRhs()
     {
         return rhs;
     }
     
+    /**
+     * 
+     * @return <code>true</code> if this production has an 
+     * epsilon transition
+     */
     public boolean hasEpsilonTransition()
     {
         return epsilonTransition;
     }
 
+    /**
+     * @return the production's LHS
+     */
     public Symbol getLhs()
     {
         return lhs;
     }
 
+    /**
+     * Set the production's LHS
+     */
     public void setLhs( Symbol lhs )
     {
         this.lhs = lhs;
-        name = lhs.getName();
     }
     
     public String toString()
     {
         StringBuilder sb = new StringBuilder();
         
-        sb.append( "Production \n<" ).append( name ).append( "> ::= " );
+        sb.append( "Production \n<" ).append( lhs.getName() ).append( "> ::= " );
         
         boolean isFirst = true;
         
@@ -99,5 +132,4 @@
         
         return sb.toString();
     }
-    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org