[jboss-svn-commits] JBL Code SVN: r34098 - in labs/jbossrules/trunk/drools-docs: drools-docs-planner/src/main/docbook/en-US/Chapter-Benchmarking_and_tweaking and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jul 21 10:22:36 EDT 2010


Author: ge0ffrey
Date: 2010-07-21 10:22:35 -0400 (Wed, 21 Jul 2010)
New Revision: 34098

Modified:
   labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt
   labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Benchmarking_and_tweaking/Chapter-Benchmarking_and_tweaking.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Local_search/Chapter-Local_search.xml
   labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Planner_configuration/Chapter-Planner_configuration.xml
Log:
Code highlighting role="JAVA"

Modified: labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt
===================================================================
--- labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt	2010-07-21 14:09:59 UTC (rev 34097)
+++ labs/jbossrules/trunk/drools-docs/doc-authoring-guideline-and-cheatsheet.txt	2010-07-21 14:22:35 UTC (rev 34098)
@@ -7,38 +7,57 @@
 DocBook: http://www.docbook.org/tdg5/en/html/docbook.html
          http://www.sagehill.net/docbookxsl/
 
-Word styles
------------
+Marking words in a paragraph
+----------------------------
 
 * Use <code> for package names, class names, method names, ...:
-  - the class <code>JavaDialectConfiguration</code>
-  - the package <code>drools.dialect.java.compiler</code>
-  - the method <code>toString()</code>
+    the class <code>JavaDialectConfiguration</code>
+    the package <code>drools.dialect.java.compiler</code>
+    the method <code>toString()</code>
 
 * Use <filename> for directories and files:
-  - the directory <filename>drools-docs/target/</filename>
-  - the file <filename>pom.xml</filename>
+    the directory <filename>drools-docs/target/</filename>
+    the file <filename>pom.xml</filename>
 
 * Use <command> for commands:
-  - run the command <command>mvn clean install</command>
+    run the command <command>mvn clean install</command>
 
 * Use <literal> for literals and keywords:
-  - the value <literal>null</literal>
-  - the keyword <literal>not</literal>
+    the value <literal>null</literal>
+    the keyword <literal>not</literal>
 
 * Use <emphasis> to emphasis something (turns bold).
   Note that you can use <emphasis> on <literal>, etc:
-  - <emphasis><literal>null</literal></emphasis>
+    <emphasis><literal>null</literal></emphasis>
 
-Paragraph styles
-----------------
+Marking paragraphs
+------------------
 
 * <caution><para></para></caution>
+
 * <important><para></para></important>
+
 * <note><para></para></note>
+
 * <tip><para></para></tip>
+
 * <warning><para></para></warning>
 
+* Use <programlisting> for code listings:
+    <programlisting><![CDATA[public interface Move ...]]></programlisting>
+
+* Use <programlisting role="JAVA"> for java code to get color highlighting.
+
+* Use <programlisting role="XML"> for XML code to get color highlighting.
+
+* Use <example> with <programlisting> for example code:
+    <example>
+      <title>Configuring the <code>JavaDialectConfiguration</code> to use JANINO via a setter</title>
+      <programlisting><![CDATA[PackageBuilderConfiguration cfg = new PackageBuilderConfiguration( );
+JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
+javaConf.setCompiler( JavaDialectConfiguration.JANINO );]]></programlisting>
+    </example>
+
 Images
 ------
 
@@ -58,56 +77,30 @@
   There is one exception: any file that use xinclude to include other files usually have a xml:base="./"
   and it should not contain images.
 
+* Use <mediaobject> with <imageobject> to show an image.
+
+* Use <figure> for diagrams with a title:
+    <figure>
+      <title>High-level View of a Rule Engine</title>
+      <mediaobject>
+        <imageobject>
+          <imagedata align="center"
+              fileref="images/Chapter-Rule_Engine/rule-engine-inkscape.svg"
+              format="SVG" contentwidth="540px" contentdepth="300px" />
+        </imageobject>
+      </mediaobject>
+    </figure>
+
+* For HTML, width="100%" ensures that imagedata is scaled down to the
+  current width of the browser's window.
+
 Linking syntax in DocBook 5.0+:
 -------------------------------
 http://www.sagehill.net/docbookxsl/Db5Tools.html#Db5UnivLinking
 
 Note: The jboss docbook xsl does not support docbook 5.0 syntax yet,
-so please use the docbook 4.5 linking syntax for the links. 
+so please use the docbook 4.5 linking syntax for the links.
 
-Markup program list or console output:
---------------------------------------
-
-* as Example:
-
-    <example>
-      <title>Configuring the <code>JavaDialectConfiguration</code> 
-      to use JANINO via a setter</title>
-
-      <programlisting><![CDATA[PackageBuilderConfiguration cfg = new PackageBuilderConfiguration( );
-JavaDialectConfiguration javaConf = (JavaDialectConfiguration) cfg.getDialectConfiguration( "java" );
-javaConf.setCompiler( JavaDialectConfiguration.JANINO );]]></programlisting>
-    </example>
-
-* Simple (not as Example):
-
-  <programlisting><![CDATA[ your code here...  ]]></programlisting>
-  
-
-Link image files:
------------------
-
-* suitable for diagrams:
-
-  <figure>
-    <title>High-level View of a Rule Engine</title>
-    <mediaobject>
-      <imageobject>
-        <imagedata align="center" 
-        fileref="images/Chapter-Rule_Engine/rule-engine-inkscape.svg" 
-        format="SVG" contentwidth="540px" contentdepth="300px" />
-      </imageobject>
-    </mediaobject>
-  </figure>
-
-  For HTML, width="100%" ensures that imagedata is scaled down to the
-  current width of the browser's window.
-
-
-* suitable for screenshots:
-
-  TODO
-
 Lists
 -----
 

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Benchmarking_and_tweaking/Chapter-Benchmarking_and_tweaking.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Benchmarking_and_tweaking/Chapter-Benchmarking_and_tweaking.xml	2010-07-21 14:09:59 UTC (rev 34097)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Benchmarking_and_tweaking/Chapter-Benchmarking_and_tweaking.xml	2010-07-21 14:22:35 UTC (rev 34098)
@@ -24,7 +24,7 @@
     <para>You can build a <literal>Benchmarker</literal> instance with the<literal>XmlSolverBenchmarker</literal>.
     Configure it with a benchmarker configuration xml file:</para>
 
-    <programlisting>    XmlSolverBenchmarker benchmarker = new XmlSolverBenchmarker();
+    <programlisting role="JAVA">    XmlSolverBenchmarker benchmarker = new XmlSolverBenchmarker();
     benchmarker.configure("/org/drools/planner/examples/nqueens/benchmark/nqueensSolverBenchmarkConfig.xml");
     benchmarker.benchmark();
     benchmarker.writeResults(resultFile);</programlisting>

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Local_search/Chapter-Local_search.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Local_search/Chapter-Local_search.xml	2010-07-21 14:09:59 UTC (rev 34097)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Local_search/Chapter-Local_search.xml	2010-07-21 14:22:35 UTC (rev 34098)
@@ -110,7 +110,7 @@
 
     <para>Each of your move types will be an implementation of the <literal>Move</literal> interface:</para>
 
-    <programlisting>public interface Move {
+    <programlisting role="JAVA">public interface Move {
 
     boolean isMoveDoable(EvaluationHandler evaluationHandler);
 
@@ -123,7 +123,7 @@
     <para>Let's take a look at the <literal>Move</literal> implementation for 4 queens which moves a queen to a
     different row:</para>
 
-    <programlisting>public class YChangeMove implements Move {
+    <programlisting role="JAVA">public class YChangeMove implements Move {
 
     private Queen queen;
     private int toY;
@@ -143,7 +143,7 @@
     <literal>Move</literal> implementation must notify the working memory of any changes it does on the solution
     facts:</para>
 
-    <programlisting>    public void doMove(WorkingMemory workingMemory) {
+    <programlisting role="JAVA">    public void doMove(WorkingMemory workingMemory) {
         FactHandle queenHandle = workingMemory.getFactHandle(queen);
         queen.setY(toY);
         workingMemory.update(queenHandle, queen); // after changes are made
@@ -171,7 +171,7 @@
     <para>In the n queens example, a move which moves the queen from its current row to the same row isn't
     doable:</para>
 
-    <programlisting>    public boolean isMoveDoable(WorkingMemory workingMemory) {
+    <programlisting role="JAVA">    public boolean isMoveDoable(WorkingMemory workingMemory) {
         int fromY = queen.getY();
         return fromY != toY;
     }</programlisting>
@@ -184,7 +184,7 @@
     C0</emphasis>. An undo move can be created from a move, but only before the move has been done on the current
     solution.</para>
 
-    <programlisting>    public Move createUndoMove(WorkingMemory workingMemory) {
+    <programlisting role="JAVA">    public Move createUndoMove(WorkingMemory workingMemory) {
         return new YChangeMove(queen, queen.getY());
     }</programlisting>
 
@@ -197,7 +197,7 @@
     <para>A move must implement the <literal>equals()</literal> and <literal>hashcode()</literal> methods. 2 moves which
     make the same change on a solution, must be equal.</para>
 
-    <programlisting>    public boolean equals(Object o) {
+    <programlisting role="JAVA">    public boolean equals(Object o) {
         if (this == o) {
             return true;
         } else if (o instanceof YChangeMove) {
@@ -226,7 +226,7 @@
     <para>It's also recommended to implement the <literal>toString()</literal> method as it allows you to read Drools
     Planner's logging more easily:</para>
 
-    <programlisting>    public String toString() {
+    <programlisting role="JAVA">    public String toString() {
         return queen + " =&gt; " + toY;
     }</programlisting>
 
@@ -271,7 +271,7 @@
 
     <para>Move generation currently happens with a <literal>MoveFactory</literal>:</para>
 
-    <programlisting>public class NQueensMoveFactory extends CachedMoveListMoveFactory {
+    <programlisting role="JAVA">public class NQueensMoveFactory extends CachedMoveListMoveFactory {
 
     public List&lt;Move&gt; createMoveList(Solution solution) {
         NQueens nQueens = (NQueens) solution;
@@ -518,7 +518,7 @@
             <para>To use property tabu, your moves must implement the <literal>TabuPropertyEnabled</literal> interface,
             for example:</para>
 
-            <programlisting>public class YChangeMove implements Move, TabuPropertyEnabled {
+            <programlisting role="JAVA">public class YChangeMove implements Move, TabuPropertyEnabled {
 
     private Queen queen;
     private int toY;
@@ -533,12 +533,12 @@
 
             <para>You can also make multiple properties tabu (with OR or AND semantics):</para>
 
-            <programlisting>    public List&lt;? extends Object&gt; getTabuPropertyList() {
+            <programlisting role="JAVA">    public List&lt;? extends Object&gt; getTabuPropertyList() {
         // tabu with other moves that contain the same leftExam OR the same rightExam
         return Arrays.asList(leftExam, rightExam);
     }</programlisting>
 
-            <programlisting>    public List&lt;? extends Object&gt; getTabuPropertyList() {
+            <programlisting role="JAVA">    public List&lt;? extends Object&gt; getTabuPropertyList() {
         // tabu with other moves that contain the same exam AND the same toPeriod (but not necessary the same toRoom)
         return Collections.singletonList(Arrays.asList(exam, toPeriod));
     }</programlisting>
@@ -684,7 +684,7 @@
     <para>You can listen to solver events, including when the best solution changes during solving, by adding a
     <literal>SolverEventListener</literal> to the <literal>Solver</literal>:</para>
 
-    <programlisting>public interface Solver {
+    <programlisting role="JAVA">public interface Solver {
 
     // ...
 
@@ -808,7 +808,7 @@
       a server restart. That cannot be configured by a <literal>Termination</literal> as it's impossible to predict when
       and if it will occur. Therefor the <literal>Solver</literal> interface has these 2 thread-safe methods:</para>
 
-      <programlisting>public interface Solver {
+      <programlisting role="JAVA">public interface Solver {
 
     // ...
 

Modified: labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Planner_configuration/Chapter-Planner_configuration.xml
===================================================================
--- labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Planner_configuration/Chapter-Planner_configuration.xml	2010-07-21 14:09:59 UTC (rev 34097)
+++ labs/jbossrules/trunk/drools-docs/drools-docs-planner/src/main/docbook/en-US/Chapter-Planner_configuration/Chapter-Planner_configuration.xml	2010-07-21 14:22:35 UTC (rev 34098)
@@ -220,7 +220,7 @@
 
     <para>Every build-in solver implemented in Drools Planner implements the <literal>Solver</literal> interface:</para>
 
-    <programlisting>public interface Solver {
+    <programlisting role="JAVA">public interface Solver {
 
     void setStartingSolution(Solution solution);
 
@@ -244,7 +244,7 @@
     <para>You can build a <literal>Solver</literal> instance with the <literal>XmlSolverConfigurer</literal>. Configure
     it with a solver configuration XML file:</para>
 
-    <programlisting>    XmlSolverConfigurer configurer = new XmlSolverConfigurer();
+    <programlisting role="JAVA">    XmlSolverConfigurer configurer = new XmlSolverConfigurer();
     configurer.configure("/org/drools/planner/examples/nqueens/solver/nqueensSolverConfig.xml");
     Solver solver = configurer.buildSolver();</programlisting>
 
@@ -348,7 +348,7 @@
 
     <para>You need to implement the <literal>Solution</literal> interface:</para>
 
-    <programlisting>public interface Solution {
+    <programlisting role="JAVA">public interface Solution {
 
     Score getScore();
     void setScore(Score score);
@@ -361,7 +361,7 @@
 
     <para>For example, an NQueens instance just holds a list of all its queens:</para>
 
-    <programlisting>public class NQueens implements Solution {
+    <programlisting role="JAVA">public class NQueens implements Solution {
 
     private List&lt;Queen&gt; queenList;
 
@@ -377,7 +377,7 @@
       is usually typed to the specific <literal>Score</literal> implementation you use. For example, NQueens uses a
       <literal>SimpleScore</literal>:</para>
 
-      <programlisting>    private SimpleScore score;
+      <programlisting role="JAVA">    private SimpleScore score;
 
     public SimpleScore getScore() {
         return score;
@@ -395,7 +395,7 @@
       memory. Those facts can be used by the score rules. For example, <literal>NQueens</literal> just returns all
       <literal>Queen</literal> instances.</para>
 
-      <programlisting>    public Collection&lt;? extends Object&gt; getFacts() {
+      <programlisting role="JAVA">    public Collection&lt;? extends Object&gt; getFacts() {
         return queenList;
     }</programlisting>
     </section>
@@ -407,7 +407,7 @@
       encounter a new best solution. The <literal>NQueens</literal> implementation just clones all
       <literal>Queen</literal> instances:</para>
 
-      <programlisting>    public NQueens cloneSolution() {
+      <programlisting role="JAVA">    public NQueens cloneSolution() {
         NQueens clone = new NQueens();
         List&lt;Queen&gt; clonedQueenList = new ArrayList&lt;Queen&gt;(queenList.size());
         for (Queen queen : queenList) {
@@ -423,7 +423,7 @@
       example the lectures are cloned, but teachers, courses, timeslots, periods, rooms, ... are not cloned because only
       a lecture's appointed period or room changes during solving:</para>
 
-      <programlisting>    /**
+      <programlisting role="JAVA">    /**
      * Clone will only deep copy the {@link #lectureList}.
      */
     public CurriculumCourseSchedule cloneSolution() {
@@ -454,7 +454,7 @@
 
     <para>First, you will need to make a starting solution and set that on the solver:</para>
 
-    <programlisting>solver.setStartingSolution(startingSolution);</programlisting>
+    <programlisting role="JAVA">solver.setStartingSolution(startingSolution);</programlisting>
 
     <section>
       <title>A simple filler algorithm</title>
@@ -474,7 +474,7 @@
 
       <para>Here's how we generate it:</para>
 
-      <programlisting>    private NQueens createNQueens(int n) {
+      <programlisting role="JAVA">    private NQueens createNQueens(int n) {
         NQueens nQueens = new NQueens();
         nQueens.setId(0L);
         List&lt;Queen&gt; queenList = new ArrayList&lt;Queen&gt;(n);
@@ -525,7 +525,7 @@
       initializer to give the real solver a serious head start. You can do this by implementing the
       <literal>StartingSolutionInitializer</literal> interface:</para>
 
-      <programlisting>public interface StartingSolutionInitializer extends SolverAware {
+      <programlisting role="JAVA">public interface StartingSolutionInitializer extends SolverAware {
 
     boolean isSolutionInitialized(Solution solution);
 
@@ -554,7 +554,7 @@
 
     <para>Solving a problem is quite easy once you have a solver and the starting solution:</para>
 
-    <programlisting>    solver.setStartingSolution(startingSolution);
+    <programlisting role="JAVA">    solver.setStartingSolution(startingSolution);
     solver.solve();
     Solution bestSolution = solver.getBestSolution();</programlisting>
 



More information about the jboss-svn-commits mailing list