org.drools.examples.manners
Class MannersBase

java.lang.Object
  extended byorg.drools.examples.manners.MannersBase
Direct Known Subclasses:
MannersExample, MannersJSR94, MannersNative

public abstract class MannersBase
extends java.lang.Object

Miss Manners is a program which handles the problem of finding an acceptable seating arrangement for guests at a dinner party. It will attempt to match people with the same hobbies, and to seat everyone next to a member of the opposite sex. Manners is a small program, which has only few rules, and employs a depth-first search approach to the problem.

 

Field Summary
protected  int maxHobbies
          Maximun number of hobbies each guest should have (default: 3).
protected  int minHobbies
          Minimum number of hobbies each guest should have (default: 2).
protected  int numGuests
          Number of guests at the dinner (default: 16).
protected  int numSeats
          Number of seats at the table (default: 16).
protected  java.lang.String ruleUri
          URI of file containing rule-set (default: 'manners.java.drl').
 
Constructor Summary
protected MannersBase(java.lang.String[] args)
           
 
Method Summary
protected  java.io.InputStream generateData()
           
protected  java.util.List getInputObjects(java.io.InputStream inputStream)
          Convert the facts from the InputStream to a list of objects.
protected  void run()
           
protected abstract  void setUp()
          Setup the test case.
protected abstract  void tearDown()
          Tear down the test case.
protected abstract  java.util.List test(java.util.List inList)
          Just do it.
protected static int validateResults(java.util.List inList, java.util.List outList)
          Verify that each guest has at least one common hobby with the guest before him/her.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ruleUri

protected java.lang.String ruleUri
URI of file containing rule-set (default: 'manners.java.drl').


numGuests

protected int numGuests
Number of guests at the dinner (default: 16).


numSeats

protected int numSeats
Number of seats at the table (default: 16).


minHobbies

protected int minHobbies
Minimum number of hobbies each guest should have (default: 2).


maxHobbies

protected int maxHobbies
Maximun number of hobbies each guest should have (default: 3).

Constructor Detail

MannersBase

protected MannersBase(java.lang.String[] args)
Method Detail

run

protected void run()
            throws java.lang.Exception
Throws:
java.lang.Exception

setUp

protected abstract void setUp()
                       throws java.lang.Exception
Setup the test case.

Throws:
java.lang.Exception

tearDown

protected abstract void tearDown()
                          throws java.lang.Exception
Tear down the test case.

Throws:
java.lang.Exception

test

protected abstract java.util.List test(java.util.List inList)
                                throws java.lang.Exception
Just do it.

Throws:
java.lang.Exception

validateResults

protected static int validateResults(java.util.List inList,
                                     java.util.List outList)
Verify that each guest has at least one common hobby with the guest before him/her.


getInputObjects

protected java.util.List getInputObjects(java.io.InputStream inputStream)
                                  throws java.io.IOException
Convert the facts from the InputStream to a list of objects.

Throws:
java.io.IOException

generateData

protected java.io.InputStream generateData()