try {
// MemoryVisitor visitor = new MemoryVisitor( ( InternalWorkingMemory ) workingMemory );
// visitor.visit( workingMemory.getRuleBase() );
Rule rule = drools.getRule();
Tuple tuple = drools.getTuple();
Context context = (Context) drools.get( contextDeclaration );
Count count = (Count) drools.get( countDeclaration );
int seatId = seatingIdDeclaration.getExtractor().getIntValue( (InternalWorkingMemory) workingMemory,
tuple.get( seatingIdDeclaration ).getObject() );
int seatingRightSeat = seatingRightSeatDeclaration.getExtractor().getIntValue( (InternalWorkingMemory) workingMemory,
tuple.get( seatingRightSeatDeclaration ).getObject() );
String leftGuestName = (String) drools.get( leftGuestNameDeclaration );
String rightGuestName = (String) drools.get( seatingRightGuestNameDeclaration );
Hobby rightGuestHobby = (Hobby) drools.get( rightGuestHobbyDeclaration );
Seating seating = new Seating( count.getValue(),
seatId,
false,
seatingRightSeat,
rightGuestName,
seatingRightSeat + 1,
leftGuestName );
drools.insert( seating );
Path path = new Path( count.getValue(),
seatingRightSeat + 1,
leftGuestName );
drools.insert( path );
Chosen chosen = new Chosen( seatId,
leftGuestName,
rightGuestHobby );
drools.insert( chosen );
count.setValue( count.getValue() + 1 );
// if ( count.getValue() == 5 ) {
// drools.retractObject( tuple.getFactHandleForDeclaration( countDeclaration ) );
// } else {
// drools.update( tuple.getFactHandleForDeclaration( countDeclaration ),
// count );
// }
drools.update( tuple.get( countDeclaration ),
count );
context.setState( Context.MAKE_PATH );
drools.update( tuple.get( contextDeclaration ),
context );
System.err.println( "find seating : " + seating + " : " + path + " : " + chosen );
} catch ( Exception e ) {