[jboss-svn-commits] JBL Code SVN: r20827 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: rule and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jun 27 02:19:48 EDT 2008


Author: michael.neale at jboss.com
Date: 2008-06-27 02:19:48 -0400 (Fri, 27 Jun 2008)
New Revision: 20827

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DynamicFact.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java
Log:
javadoc tidy up only

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java	2008-06-27 05:25:51 UTC (rev 20826)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBase.java	2008-06-27 06:19:48 UTC (rev 20827)
@@ -65,8 +65,8 @@
     /**
      * Create a new <code>WorkingMemory</code> session for this
      * <code>RuleBase</code>.
-     * 
-     * @param config the session configuration object to use for the 
+     *
+     * @param config the session configuration object to use for the
      *               created session.
      *
      * @see WorkingMemory
@@ -172,10 +172,16 @@
     public StatefulSession[] getStatefulSessions();
 
     /**
-     * Returns a declared FactType for external handling
-     * 
-     * @param string
-     * @return
+     * Returns a declared FactType.
+     * FactTypes are types that are declared as part of the rules (an alternative to POJOs).
+     * From a fact type you can generate instances of facts which you can use to communicate with the engine.
+     *
+     * @param string - the name of the declared type (a type defined in the rules).
+     * This would typically be packagename + . + type name.
+     *
+     * Eg, if there is a delcared type of name "Driver", and the package name is "com.company".
+     * Then the string you pass in would be "com.company.Driver".
+     *
      */
     public FactType getFactType(String string);
 }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DynamicFact.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DynamicFact.java	2008-06-27 05:25:51 UTC (rev 20826)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/DynamicFact.java	2008-06-27 06:19:48 UTC (rev 20827)
@@ -72,34 +72,33 @@
 	}
 
 	public Set<String> keySet() {
-		return null;
+		throw new UnsupportedOperationException();
 	}
 
 	public Object put(String key, Object value) {
-		// TODO Auto-generated method stub
-		return null;
+		Object old = this.typeDef.get(bean, key);
+		this.typeDef.set(this.bean, key, value);
+		return old;
 	}
 
 	public void putAll(Map arg0) {
-		// TODO Auto-generated method stub
-
+		throw new UnsupportedOperationException();
 	}
 
 	public Object remove(Object arg0) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+		throw new UnsupportedOperationException();	}
 
 	public int size() {
-		// TODO Auto-generated method stub
-		return 0;
+		return this.typeDef.getFields().size();
 	}
 
 	public Collection values() {
-		// TODO Auto-generated method stub
-		return null;
+		throw new UnsupportedOperationException();
 	}
 
+	/**
+	 * Return the underlying fact itself. This is what you asset into the session/engine.
+	 */
 	public Object getFactObject() {
 		return this.bean;
 	}

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java	2008-06-27 05:25:51 UTC (rev 20826)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/FactType.java	2008-06-27 06:19:48 UTC (rev 20827)
@@ -27,7 +27,7 @@
  * You then communicate with the rulebase/knowledge base by using instances created by this.
  * There are utility set and get methods on this, as well as in the FieldAccessors.
  *
- * The Object that is used is a javabean (which was generated by the rules).
+ * The Object that is used is a javabean (which was generated by the rules). You can also use reflection on it as normal.
  *
  * @author etirelli
  */
@@ -61,12 +61,12 @@
     public Object get(Object bean, String field);
 
     /**
-     * Sets a whole chunk of fields at once.
+     * Get a map of the fields and their values for the bean.
      */
     public Map<String, Object> getAsMap(Object bean);
 
     /**
-     * Get the values of a dynamic fact as a map.
+     * Set the values of the bean from a map.
      */
     public void setFromMap(Object bean, Map<String, Object> values);
 }




More information about the jboss-svn-commits mailing list